hy yii developers
i am learning yii from scratch and i am stopped at adding foreign key in yii
look this is what i want i have 2 tables user
and store
and i want user_id
in store
table when a user
registered a new store
user
table structure:
`CREATE TABLE IF NOT EXISTS `user` (
`user_id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`username` varchar(255) NOT NULL,
`mobile` bigint(20) NOT NULL,
`password` varchar(255) NOT NULL,
`authkey` varchar(255) NOT NULL,
`created_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
PRIMARY KEY (`user_id`)
) ENGINE=MyISAM AUTO_INCREMENT=9 DEFAULT CHARSET=utf8;`
store
table structure:
`CREATE TABLE IF NOT EXISTS `store` (
`seller_id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`store_name` varchar(255) NOT NULL,
`store_no` bigint(10) NOT NULL,
`address` varchar(255) NOT NULL,
`pincode` bigint(10) NOT NULL,
`type` varchar(255) NOT NULL,
`mobile` bigint(10) NOT NULL,
`created_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
PRIMARY KEY (`seller_id`)
) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;`
i want
user_id
instore
table if user registered a new store thank you
plzz ignore my mistake and interested to read code if exists it online if topic is same as mine