Selaa lähdekoodia

SQL FKs

pull/7/head
Daniel Covington 7 kuukautta sitten
vanhempi
commit
52675d113d
4 muutettua tiedostoa jossa 53 lisäystä ja 2 poistoa
  1. +2
    -0
      .gitignore
  2. +20
    -0
      Data/Migrations/Migration_10_Alter_Tables_For_Relations.asp
  3. +27
    -0
      Data/Migrations/Migration_11_Alter_Tables_For_Relations_FK.asp
  4. +4
    -2
      Data/Migrations/migrate.asp

+ 2
- 0
.gitignore Näytä tiedosto

@@ -0,0 +1,2 @@
*.csv
*.mdb

+ 20
- 0
Data/Migrations/Migration_10_Alter_Tables_For_Relations.asp Näytä tiedosto

@@ -0,0 +1,20 @@
<%
Class Migration_10_Alter_Tables_For_Relations
Public Migration

Public Sub Up
Migration.Do "ALTER TABLE [InkjetRecords] " &_
"ALTER COLUMN [KitID] LONG;"
Migration.Do "ALTER TABLE [KitLabels] " &_
"ALTER COLUMN [KitID] LONG;"
End Sub
Public Sub Down
Migration.Do "ALTER TABLE [InkjetRecords] " &_
"ALTER COLUMN [KitID] NUMBER;"
Migration.Do "ALTER TABLE [KitLabels] " &_
"ALTER COLUMN [KitID] NUMBER;"
End Sub
End Class
Migrations.Add "Migration_10_Alter_Tables_For_Relations"
%>

+ 27
- 0
Data/Migrations/Migration_11_Alter_Tables_For_Relations_FK.asp Näytä tiedosto

@@ -0,0 +1,27 @@
<%
Class Migration_11_Alter_Tables_For_Relations_FK
Public Migration

Public Sub Up
Migration.Do "ALTER TABLE [InkjetRecords] ADD CONSTRAINT [KitInkjetRecords]" &_
" FOREIGN KEY ( [KitID] )" &_
" REFERENCES [Kit] ( [ID] )" &_
" ON UPDATE CASCADE" &_
" ON DELETE CASCADE;"
Migration.Do "ALTER TABLE [KitLabels] ADD CONSTRAINT [KitKitLabels]" &_
" FOREIGN KEY ( [KitID] )" &_
" REFERENCES [Kit] ( [ID] )" &_
" ON UPDATE CASCADE" &_
" ON DELETE CASCADE;"
End Sub
Public Sub Down
Migration.Do "ALTER TABLE [InkjetRecords] " &_
"DROP CONSTRAINT [KitInkjetRecords];"
Migration.Do "ALTER TABLE [KitLabels] " &_
"DROP CONSTRAINT [KitKitLabels];"
End Sub
End Class
Migrations.Add "Migration_11_Alter_Tables_For_Relations_FK"
%>

+ 4
- 2
Data/Migrations/migrate.asp Näytä tiedosto

@@ -24,8 +24,8 @@ End Sub
'TODO: This can be refactored by not having the individual migration files auto-add themselves, but then this file must manually add each one using a slightly dIfferent
' naming convention, i.e. given include file 01_Create_Users.asp the command would be Migrations.Add "Migration_01_Create_Users" or such. At least this way is automated.

'Migrations.Initialize "Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:Engine Type=5;Data Source=" & Request.ServerVariables("APPL_PHYSICAL_PATH") & "Data\webdata - Copy.mdb;"
Migrations.Initialize "Provider=SQLOLEDB;Server=danielsubuntu,15789;Database=tracking;UID=sa;PWD=SunBrightShine!;"
Migrations.Initialize "Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:Engine Type=5;Data Source=" & Request.ServerVariables("APPL_PHYSICAL_PATH") & "Data\webdata - Copy.mdb;"
'Migrations.Initialize "Provider=SQLOLEDB;Server=danielsubuntu,15789;Database=tracking;UID=sa;PWD=SunBrightShine!;"
Migrations.Tracing = false
%>

@@ -38,6 +38,8 @@ Migrations.Tracing = false
<!--#include file="Migration_07_Alter_Kit_Table_Labels_With_Set.asp"-->
<!--#include file="Migration_08_Alter_Kit_Table_With_InkjetJob.asp"-->
<!--#include file="Migration_09_Create_InkJetRecords_Table.asp"-->
<!--#include file="Migration_10_Alter_Tables_For_Relations.asp"-->
<!--#include file="Migration_11_Alter_Tables_For_Relations_FK.asp"-->
<%
Sub HandleMigration
putl "<b>Starting Version: " & Migrations.Version & "</b>"


Loading…
Peruuta
Tallenna

Powered by TurnKey Linux.