mysql - How to drop table when a colum was setted cascade -


i have issue mariadb query. have 2 tables below

 create table kayttaja (       kayttaja_id integer not null auto_increment primary key,       kayttaja_tunnus varchar(255) not null unique,       kayttaja_salasana_encrypted varchar(255) not null,       kayttaja_enabled tinyint not null,       kayttaja_suku varchar(255) default null,       kayttaja_etu varchar(255) default null,       constraint fk_rooli_id foreign key(fk_rooli_id) references rooli(rooli_id)     ) engine=innodb default charset=utf8;  create table kayttaja_rooli (   id integer not null auto_increment primary key,   fk_kayttaja_id integer not null,   fk_rooli_id integer not null,   foreign key (fk_kayttaja_id) references kayttaja(kayttaja_id) on delete no action on update no action,   foreign key (fk_rooli_id) references rooli(rooli_id) on delete no action on update no action ) engine=innodb default charset=utf8; 

now want drop kayttaja table, how can do? i've drop kayttaja_rooli table, thanks.

you can drop using

drop table if exists kayttaja; 

if have problems foreign key youcan disable them ,drop table , enable them again

set foreign_key_checks = 0; drop table if exists kayttaja; set foreign_key_checks = 1; 

Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -