Lines 1-20
Link Here
|
1 |
$DBversion = 'XXX'; # will be replaced by the RM |
1 |
$DBversion = 'XXX'; # will be replaced by the RM |
2 |
if ( CheckVersion($DBversion) ) { |
2 |
if ( CheckVersion($DBversion) ) { |
3 |
|
3 |
|
4 |
$dbh->do(qq{ |
4 |
unless ( TableExists( 'cash_registers' ) ) { |
5 |
CREATE TABLE `cash_registers` ( |
5 |
$dbh->do(qq{ |
6 |
`id` int(11) NOT NULL auto_increment, -- unique identifier for each account register |
6 |
CREATE TABLE `cash_registers` ( |
7 |
`name` varchar(24) NOT NULL, -- the user friendly identifier for each account register |
7 |
`id` int(11) NOT NULL auto_increment, -- unique identifier for each account register |
8 |
`description` longtext NOT NULL, -- the user friendly description for each account register |
8 |
`name` varchar(24) NOT NULL, -- the user friendly identifier for each account register |
9 |
`branch` varchar(10) NOT NULL, -- the foreign key the library this account register belongs |
9 |
`description` longtext NOT NULL, -- the user friendly description for each account register |
10 |
`branch_default` tinyint(1) NOT NULL DEFAULT 0, -- boolean flag to denote that this till is the branch default |
10 |
`branch` varchar(10) NOT NULL, -- the foreign key the library this account register belongs |
11 |
`starting_float` decimal(28, 6), -- the starting float this account register should be assigned |
11 |
`branch_default` tinyint(1) NOT NULL DEFAULT 0, -- boolean flag to denote that this till is the branch default |
12 |
`archived` tinyint(1) NOT NULL DEFAULT 0, -- boolean flag to denote if this till is archived or not |
12 |
`starting_float` decimal(28, 6), -- the starting float this account register should be assigned |
13 |
PRIMARY KEY (`id`), |
13 |
`archived` tinyint(1) NOT NULL DEFAULT 0, -- boolean flag to denote if this till is archived or not |
14 |
UNIQUE KEY `name` (`name`,`branch`), |
14 |
PRIMARY KEY (`id`), |
15 |
CONSTRAINT cash_registers_branch FOREIGN KEY (branch) REFERENCES branches (branchcode) ON UPDATE CASCADE ON DELETE CASCADE |
15 |
UNIQUE KEY `name` (`name`,`branch`), |
16 |
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci; |
16 |
CONSTRAINT cash_registers_branch FOREIGN KEY (branch) REFERENCES branches (branchcode) ON UPDATE CASCADE ON DELETE CASCADE |
17 |
}); |
17 |
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci; |
|
|
18 |
}); |
19 |
} |
18 |
|
20 |
|
19 |
unless ( column_exists( 'accountlines', 'register_id' ) ) { |
21 |
unless ( column_exists( 'accountlines', 'register_id' ) ) { |
20 |
$dbh->do(qq{ALTER TABLE `accountlines` ADD `register_id` int(11) NULL DEFAULT NULL AFTER `manager_id`}); |
22 |
$dbh->do(qq{ALTER TABLE `accountlines` ADD `register_id` int(11) NULL DEFAULT NULL AFTER `manager_id`}); |
21 |
- |
|
|