Linking to DB using Perforce

A SQL Server Management Studio add-in to source control your database in Subversion or Team Foundation Server.

Moderators: Chris Auckland, David Atkinson, sherr, PhilScrace

Linking to DB using Perforce

Postby kckndrgn » Fri Oct 14, 2011 4:27 pm

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.
kckndrgn
 
Posts: 2
Joined: Wed Oct 12, 2011 1:22 am

Postby james.billings » Mon Oct 17, 2011 12:47 pm

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?
james.billings
 
Posts: 1144
Joined: Wed Jun 16, 2010 11:10 am
Location: My desk.

Postby SeaSharp » Tue Oct 18, 2011 9:59 pm

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: Select all
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
SeaSharp
 
Posts: 9
Joined: Wed Sep 21, 2011 9:00 pm

Postby james.billings » Wed Oct 19, 2011 12:06 pm

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.
james.billings
 
Posts: 1144
Joined: Wed Jun 16, 2010 11:10 am
Location: My desk.

Postby SeaSharp » Wed Oct 19, 2011 10:03 pm

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.
SeaSharp
 
Posts: 9
Joined: Wed Sep 21, 2011 9:00 pm

Postby james.billings » Thu Oct 20, 2011 4:39 pm

Thanks for posting this - hopefully it'll be of value to other users who are having trouble!
james.billings
 
Posts: 1144
Joined: Wed Jun 16, 2010 11:10 am
Location: My desk.


Return to SQL Source Control 2

Who is online

Users browsing this forum: No registered users and 0 guests