maximozz / solidaria

0 stars 0 forks source link

Create DB table for generator purchase packages #3

Open maximozz opened 9 years ago

maximozz commented 9 years ago

named custom table 'mozz_genpackages' make .sql file

1) copied structure from 'elgg_entities' table 2) edited and added relevant fields and indexes, f.e. ALTER TABLE mozz_genpackages CHANGE type type ENUM( '1/0', '1/3', '2/7', '3/12', '5/23', '10/53', '20/130', '50/400', '100/1000' ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL , ALTER TABLE mozz_genpackages ADD price DECIMAL( 14, 6 ) NOT NULL AFTER subtype , ALTER TABLE mozz_genpackages ADD currency CHAR( 3 ) NOT NULL AFTER price ,

, etc. 3) result - table structure CREATE TABLE IF NOT EXISTS mozz_genpackages ( id bigint(20) unsigned NOT NULL AUTO_INCREMENT, type enum('1/0','1/3','2/7','3/12','5/23','10/53','20/130','50/400','100/1000') NOT NULL, subtype int(11) DEFAULT NULL, price decimal(14,6) NOT NULL, currency char(3) NOT NULL, buyer_id bigint(20) unsigned NOT NULL, seller_id bigint(20) unsigned NOT NULL, container_id bigint(20) unsigned NOT NULL, access_id int(11) NOT NULL, time_purchased int(11) NOT NULL, enabled enum('yes','no') NOT NULL DEFAULT 'yes', PRIMARY KEY (id), KEY type (type), KEY subtype (subtype), KEY container_guid (container_id), KEY access_id (access_id), KEY time_created (time_purchased), KEY buyer_guid (buyer_id), KEY seller_guid (seller_id) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;