Repository navigation
Expand file tree
/
Copy pathdatabaseWorkwise.sqbpro
More file actions
43 lines (21 loc) 路 2.33 KB
/
Copy pathdatabaseWorkwise.sqbpro
File metadata and controls
43 lines (21 loc) 路 2.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?xml version="1.0" encoding="UTF-8"?><sqlb_project><db path="databaseWorkwise.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="2987"/><column_width id="4" width="0"/><expanded_item id="0" parent="1"/><expanded_item id="1" parent="1"/><expanded_item id="2" parent="1"/><expanded_item id="3" parent="1"/></tab_structure><tab_browse><table title="sqlite_sequence" custom_title="0" dock_id="1" table="4,15:mainsqlite_sequence"/><dock_state state="000000ff00000000fd0000000100000002000002480000020bfc0100000001fb000000160064006f0063006b00420072006f00770073006500310100000000000002480000011800ffffff000002480000000000000004000000040000000800000008fc00000000"/><default_encoding codec=""/><browse_table_settings><table schema="main" name="sqlite_sequence" show_row_id="0" encoding="" plot_x_axis="" unlock_view_pk="_rowid_" freeze_columns="0"><sort/><column_widths><column index="1" value="46"/><column index="2" value="29"/></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*">-- Create the unions table
CREATE TABLE IF NOT EXISTS unions (
union_id INTEGER PRIMARY KEY AUTOINCREMENT,
register_num TEXT UNIQUE NOT NULL,
sector_info TEXT NOT NULL,
membership_size INTEGER DEFAULT 0,
is_active_council BOOLEAN DEFAULT FALSE,
created_at TEXT DEFAULT (datetime('now'))
);
-- Create the union_members table
CREATE TABLE IF NOT EXISTS union_members (
membership_id INTEGER PRIMARY KEY AUTOINCREMENT,
worker_id INTEGER NOT NULL,
union_id INTEGER NOT NULL,
membership_num TEXT NOT NULL,
status TEXT DEFAULT 'active',
created_at TEXT DEFAULT (datetime('now')),
FOREIGN KEY (worker_id) REFERENCES users (user_id) ON DELETE CASCADE,
FOREIGN KEY (union_id) REFERENCES unions (union_id) ON DELETE CASCADE,
UNIQUE (worker_id, union_id) -- Prevent duplicate memberships per worker-union pair
);</sql><current_tab id="0"/></tab_sql></sqlb_project>