Yii2 Advanced Aula3 Gerando códigos utilizando o gii
Показать описание
A idéia é gravar um pequeno conjunto de vídeo-aulas para ajudar iniciantes na plataforma do Yii framework com conteúdo em português e de fácil entendimento.
--
-- Indexes for table `sub_categoria`
--
ALTER TABLE `sub_categoria`
ADD PRIMARY KEY (`id_sub_categoria`),
ADD KEY (`categoria_id_categoria`);
--
-- Indexes for table `user`
--
ALTER TABLE `user`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `categoria`
--
ALTER TABLE `categoria`
MODIFY `id_categoria` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `cliente`
--
ALTER TABLE `cliente`
MODIFY `id_cliente` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `compra`
--
ALTER TABLE `compra`
MODIFY `id_compra` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `cor`
--
ALTER TABLE `cor`
MODIFY `id_cor` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `fabricante`
--
ALTER TABLE `fabricante`
MODIFY `id_ fabricante` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `produto`
--
ALTER TABLE `produto`
MODIFY `id_produto` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `sub_categoria`
--
ALTER TABLE `sub_categoria`
MODIFY `id_sub_categoria` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `user`
--
ALTER TABLE `user`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `compra`
--
ALTER TABLE `compra`
ADD CONSTRAINT `fk_compra_cliente1` FOREIGN KEY (`cliente_id_cliente`) REFERENCES `cliente` (`id_cliente`) ON DELETE NO ACTION ON UPDATE NO ACTION,
ADD CONSTRAINT `fk_compra_user1` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
--
-- Constraints for table `item_compra`
--
ALTER TABLE `item_compra`
ADD CONSTRAINT FOREIGN KEY (`compra_id_compra`) REFERENCES `compra` (`id_compra`) ON DELETE NO ACTION ON UPDATE NO ACTION,
ADD CONSTRAINT FOREIGN KEY (`produto_id_produto`) REFERENCES `produto` (`id_produto`) ON DELETE NO ACTION ON UPDATE NO ACTION;
--
-- Constraints for table `produto`
--
ALTER TABLE `produto`
ADD CONSTRAINT `fk_produto_cor` FOREIGN KEY (`cor_id_cor`) REFERENCES `cor` (`id_cor`) ON DELETE NO ACTION ON UPDATE NO ACTION,
ADD CONSTRAINT `fk_produto_fabricante1` FOREIGN KEY (`fabricante_id_ fabricante`) REFERENCES `fabricante` (`id_ fabricante`) ON DELETE NO ACTION ON UPDATE NO ACTION,
ADD CONSTRAINT `fk_produto_sub_categoria1` FOREIGN KEY REFERENCES `sub_categoria` (`id_sub_categoria`) ON DELETE NO ACTION ON UPDATE NO ACTION;
--
-- Constraints for table `sub_categoria`
--
ALTER TABLE `sub_categoria`
ADD CONSTRAINT `fk_sub_categoria_categoria1` FOREIGN KEY (`categoria_id_categoria`) REFERENCES `categoria` (`id_categoria`) ON DELETE NO ACTION ON UPDATE NO ACTION;