Primeiros passos
A proposta do LazyForge é simples: modelar schema SQL em terminal, usando comandos curtos, visualização em grafo e export em DDL.
Requisitos
- Dart SDK instalado.
- Terminal com suporte a cores ANSI.
- Windows, macOS ou Linux.
Instalação
Instalação global via Git:
dart pub global activate --source git https://github.com/dte005/lazy_forges.git
lazy_forge
Instalação local para desenvolvimento:
dart pub get
dart run bin/lazy_forge.dart
Primeiro uso
- Abra uma pasta do seu projeto no terminal.
- Execute
lazy_forge. - Crie um projeto e escolha o banco (postgres/mysql/sqlite).
- Digite comandos no editor para montar o schema.
- Use
exportpara gerar o SQL DDL.
Espaço de trabalho local
O LazyForge usa o diretório atual onde você executa o comando como base de trabalho.
- Projetos salvos:
./lazyforge_projects - Exportações DDL:
./<nome_do_arquivo>.sql
Desenvolvido com
Este projeto foi desenvolvido com Warp, LazyVim, Dart e Nocterm.
Mapa de comandos
Criação e remoção
create table <table> [--autoincrement]
delete table <table>
drop table <table>
Colunas
add column <table> <column> <type> [as pk] [options(v1|v2)] [description(text)]
add column <column> type <type> to <table> [as pk] [options(v1|v2)] [description(text)]
add columns <table> <col1 type [as pk] ...; col2 type ...>
Relacionamentos
set pk <table> <column>
add fk <table> <column> references <ref_table> <ref_column>
Renomear/alterar
rename table <old> to <new>
change table <old> to <new>
rename column <table> <old> to <new>
change column <table> <old> to <new>
alter column <table> <column> type <new_type> [options(v1|v2)]
change column <table> <column> type <new_type> [options(v1|v2)]
Inspeção e export
set database <postgres|mysql|sqlite>
show database
show types
show tables
history
export [nome_arquivo.sql]
Tipos de base de dados
Postgres
smallint, integer, bigint, serial, bigserial, numeric, decimal, real, double, boolean, char, varchar, text, date, time, timestamp, timestamptz, uuid, json, jsonb, bytea, enum
MySQL
tinyint, smallint, mediumint, int, bigint, decimal, float, double, bit, char, varchar, text, tinytext, mediumtext, longtext, date, time, datetime, timestamp, year, json, binary, varbinary, blob, tinyblob, mediumblob, longblob, boolean, enum
SQLite
integer, real, text, blob, numeric, boolean, date, datetime