Red Gate forums :: View topic - Linking to DB using Perforce
Return to www.red-gate.com RSS Feed Available

Search  | Usergroups |  Profile |  Messages |  Log in  Register 
Go to product documentation
SQL Source Control 2
SQL Source Control 2 forum

Linking to DB using Perforce

Search in SQL Source Control 2 forum
Post new topic   Reply to topic
Jump to:  
Author Message
kckndrgn



Joined: 12 Oct 2011
Posts: 2

PostPosted: Fri Oct 14, 2011 4:27 pm    Post subject: Linking to DB using Perforce Reply with quote

OK, after creating a new client name to get past the first problem I had I now have another one.

When linking to Perforce, I enter the working folder, select Perforce for the source control and click "link".

here is the error i get:
Command:
P4 -s submit -d "Database project file added by Red Gate SQL Source Control" "C:\Depot\SQL\..."

Output:
error: No files to submit from the default changelist.

exit: 1

Exit code:
1

Do I need to have the SQL stored procedures already there from the DB?

Really confused on the setup documentation, nothing is very clear.
Back to top
View user's profile Send private message
james.billings



Joined: 16 Jun 2010
Posts: 1121
Location: My desk.

PostPosted: Mon Oct 17, 2011 12:47 pm    Post subject: Reply with quote

Thanks for your post, and sorry to hear you're still having trouble.

The error you're getting occurs when P4 thinks there's nothing to commit. I've seen this before but I don't precisely recall the cause unfortunately.

Can I first check what you're linking to? I noticed "Depot" in the path which suggests you may be linking to where your actual Perforce Depot is located, which isn't how it would normally do it.

The usual method, summarised, is to create a folder under an existing workspace (or create a new workspace) on your PC, specifically for the DB you're linking.
On my PC, P4V is currently using workspace "c:\MyWorkspace - the actual Depot is on another server.
So to link Adventureworks, I'd create a folder under there (i.e. C:\MyWorkspace\AdventureWorks) and ensure it's empty, the link SQL Source Control to it.

The linking process creates all the relevant files and folders, and then submits these to the Depot by calling the P4 commit command.

Can you check and see if you're following that process?
Back to top
View user's profile Send private message
SeaSharp



Joined: 21 Sep 2011
Posts: 9

PostPosted: Tue Oct 18, 2011 9:59 pm    Post subject: Reply with quote

I'm having this exact same problem. My workspace is not Depot, it is called "Services". I added the -c parameter to specify the workspace. It fails with the "No files" error message, see below. I am following the workflow described above. SqlSourceControl creates the entire directory structure under [C:\Perforce\Services\MyProject\Database\]. I can see all the folders it added for tables, sprocs, views, etc. They are all empty. SqlSourceControl also creates a RedGate.ssc file. It is an empty file with size of 0 kb.

The funny thing is that this DOES work when I specify a workspace and folder under depot such as [C:\Perforce\<MyUsername>_perforce_1666\depot\MyProject\Database]. Unfortunately, that location is not acceptable.

Code:
Command:
P4 -c Services -s submit -d "Database project file added by Red Gate SQL Source Control" "C:\Perforce\Services\MyProject\Database\..."

Output:
error: No files to submit from the default changelist.

exit: 1

Exit code:
1
Back to top
View user's profile Send private message
james.billings



Joined: 16 Jun 2010
Posts: 1121
Location: My desk.

PostPosted: Wed Oct 19, 2011 12:06 pm    Post subject: Reply with quote

You may want to try configuring folder-specific config files, as per this perforce article: http://www.perforce.com/perforce/doc.current/manuals/p4guide/02_config.html and see if it helps? I believe some users have found that a useful workaround.
Back to top
View user's profile Send private message
SeaSharp



Joined: 21 Sep 2011
Posts: 9

PostPosted: Wed Oct 19, 2011 10:03 pm    Post subject: Reply with quote

I found a working solution. The problem was with the setup of my Perforce work space. I don't know exactly what was the issue. But, here is my solution:

I started with a Perforce workspace named, "MyWorkSpace" with these directories:

C:\Perforce\MyWorkSpace\MyProject\Code\ApplicationCode
C:\Perforce\MyWorkSpace\MyProject\Code\Database

1. Removed the Database path from the MyWorkSpace workspace and created a new workspace, MyWorkSpace_Database. It is extermely important that you don't have 2 workspaces pointing to the Database path. Otherwise your files can get clobbered & out of sync when you Get Latest.
2. Mapped the new workspace (MyWorkSpace_Database) so that it only points to the database path, [C:\Perforce\MyWorkSpace\MyProject\Code\Database].
3. Opened the folder [%USERPROFILE%\AppData\Local\Red Gate\SQL Source Control 2\CommandLineHooks] in windows explorer.
4. Created a copy of the Perforce.xml file. Opened it for edit.
5. Changed the value of the <Name>Perforce</Name> element to <Name>Perforce [MyProject]</Name>
6. For each of the <CommandLine> elements added the -c MyWorkSpace_Database. For example, the commit command line now looks like this:

<CommandLine>P4 -c MyWorkSpace_Database -s sync "($ScriptsFolder)..."</CommandLine>

7. Saved the XML file.
8. Launched SQL Server and Linked to Source Control. When prompted by Sql Source Control to select the config file for source control commands I chose the one with the Name value from step 5 above.

That worked for me.


Last edited by SeaSharp on Thu Oct 20, 2011 7:00 pm; edited 3 times in total
Back to top
View user's profile Send private message
james.billings



Joined: 16 Jun 2010
Posts: 1121
Location: My desk.

PostPosted: Thu Oct 20, 2011 4:39 pm    Post subject: Reply with quote

Thanks for posting this - hopefully it'll be of value to other users who are having trouble!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic All times are GMT + 1 Hour
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group