Linking to DB using Perforce

kckndrgnkckndrgn Posts: 4
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.

Comments

  • 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?
    Systems Software Engineer

    Redgate Software

  • 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.
    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
    
  • 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.
    Systems Software Engineer

    Redgate Software

  • SeaSharpSeaSharp Posts: 10
    edited October 20, 2011 2:00PM
    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.
  • Thanks for posting this - hopefully it'll be of value to other users who are having trouble!
    Systems Software Engineer

    Redgate Software

Sign In or Register to comment.