-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdata.sqbpro
More file actions
89 lines (41 loc) · 4.54 KB
/
Copy pathdata.sqbpro
File metadata and controls
89 lines (41 loc) · 4.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?xml version="1.0" encoding="UTF-8"?><sqlb_project><db path="data.db" readonly="0" foreign_keys="1" case_sensitive_like="0" temp_store="0" wal_autocheckpoint="1000" synchronous="2"/><attached/><window><main_tabs open="structure browser pragmas query" current="0"/></window><tab_structure><column_width id="0" width="300"/><column_width id="1" width="0"/><column_width id="2" width="100"/><column_width id="3" width="8256"/><column_width id="4" width="0"/><expanded_item id="0" parent="1"/><expanded_item id="4" parent="0"/><expanded_item id="1" parent="1"/><expanded_item id="2" parent="1"/><expanded_item id="3" parent="1"/></tab_structure><tab_browse><table title="Policies" custom_title="0" dock_id="2" table="4,8:mainPolicies"/><table title="Policies" custom_title="0" dock_id="3" table="4,8:mainPolicies"/><table title="Agencies" custom_title="0" dock_id="1" table="4,8:mainAgencies"/><dock_state state="000000ff00000000fd0000000100000002000004af000002b6fc0100000001fc00000000000004af0000011800fffffffa000000000100000003fb000000160064006f0063006b00420072006f00770073006500310100000000ffffffff0000011800fffffffb000000160064006f0063006b00420072006f00770073006500320100000000ffffffff0000011800fffffffb000000160064006f0063006b00420072006f00770073006500330100000000ffffffff0000011800ffffff000002580000000000000004000000040000000800000008fc00000000"/><default_encoding codec=""/><browse_table_settings><table schema="main" name="Agencies" show_row_id="0" encoding="" plot_x_axis="" unlock_view_pk="_rowid_" freeze_columns="0"><sort/><column_widths><column index="1" value="62"/><column index="2" value="156"/><column index="3" value="52"/></column_widths><filter_values/><conditional_formats/><row_id_formats/><display_formats/><hidden_columns/><plot_y_axes/><global_filter/></table><table schema="main" name="Policies" show_row_id="0" encoding="" plot_x_axis="" unlock_view_pk="_rowid_" freeze_columns="0"><sort/><column_widths><column index="1" value="55"/><column index="2" value="68"/><column index="3" value="85"/><column index="4" value="104"/><column index="5" value="126"/><column index="6" value="157"/><column index="7" value="62"/><column index="8" value="82"/><column index="9" value="84"/><column index="10" value="62"/><column index="11" value="210"/><column index="12" value="53"/><column index="13" value="53"/><column index="14" value="95"/><column index="15" value="98"/><column index="16" value="85"/><column index="17" value="91"/><column index="18" value="135"/><column index="19" value="116"/><column index="20" value="65"/><column index="21" value="107"/><column index="22" value="85"/><column index="23" value="156"/><column index="24" value="54"/></column_widths><filter_values/><conditional_formats/><row_id_formats/><display_formats/><hidden_columns/><plot_y_axes/><global_filter/></table></browse_table_settings></tab_browse><tab_sql><sql name="SQL 1*">-- First, backup your data if needed
-- Then recreate Policies table with proper foreign key
CREATE TABLE IF NOT EXISTS Policies_new (
PolicyID INTEGER PRIMARY KEY AUTOINCREMENT,
ProductID INTEGER NOT NULL,
PolicyNumber TEXT UNIQUE NOT NULL,
OldPolicyNumber TEXT,
EndorsementNumber TEXT,
OtherEndorsementNumber TEXT DEFAULT '00000',
ClientID INTEGER NOT NULL,
EventTypeID INTEGER NOT NULL,
PolicyTypeID INTEGER NOT NULL,
OptionID INTEGER NOT NULL,
Description TEXT,
CourtierID INTEGER DEFAULT 1,
TermID INTEGER NOT NULL,
ProductionDate TEXT NOT NULL,
DurationMonths INTEGER,
ExpiryDate TEXT NOT NULL,
PurchaseOrder TEXT,
PurchaseOrderNumber TEXT,
CreditAuthorizedBy TEXT DEFAULT '---',
AgencyID INTEGER NOT NULL,
CreatedByUserID INTEGER NOT NULL,
CreatedOn TEXT NOT NULL,
UpdatedOn TEXT DEFAULT CURRENT_TIMESTAMP,
Status TEXT DEFAULT 'Active',
-- Foreign Keys
FOREIGN KEY (ProductID) REFERENCES Products(ProductID),
FOREIGN KEY (ClientID) REFERENCES Clients(ID) ON DELETE CASCADE,
FOREIGN KEY (EventTypeID) REFERENCES EventTypes(EventTypeID),
FOREIGN KEY (PolicyTypeID) REFERENCES PolicyTypes(TypeID),
FOREIGN KEY (OptionID) REFERENCES PolicyOptions(OptionID),
FOREIGN KEY (CourtierID) REFERENCES Courtiers(CourtierID),
FOREIGN KEY (TermID) REFERENCES Terms(TermID),
FOREIGN KEY (AgencyID) REFERENCES Agencies(AgencyID),
FOREIGN KEY (CreatedByUserID) REFERENCES Users(UserID)
);
-- Drop old table and rename new one
DROP TABLE Policies;
ALTER TABLE Policies_new RENAME TO Policies;</sql><current_tab id="0"/></tab_sql></sqlb_project>