Skip to content

Commit b6a5971

Browse files
authored
Merge pull request #61 from oslabs-beta/dev
DenoGres 2.0 Launch
2 parents 24cfe97 + d7aa6c7 commit b6a5971

31 files changed

Lines changed: 3422 additions & 1176 deletions

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,7 @@
11
.env
22
.vscode
3+
function.ts
4+
/application/user/uri.ts
5+
/application/fresh.gen.ts
6+
Test/henryPlayground.ts
7+
Test/henryPlayground.ts

README.md

Lines changed: 129 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,142 @@
1-
![](/public/DenoGresWide.png)
2-
Welcome to DenoGres! A new comprehensive ORM for PostgreSQL and Deno.
1+
![](/public/DenoGresWide.png) Welcome to DenoGres! A new comprehensive ORM for
2+
PostgreSQL and Deno.
33

44
## Getting Started
5-
To begin, let's download DenoGres! Execute the below in the terminal - this will give you access to DenoGres's CLI functionality.
6-
>`deno install --allow-read --allow-write --allow-net --allow-env --name denogres https://deno.land/x/denogres/mod.ts`
5+
6+
To begin, let's download DenoGres! Execute the below in the terminal - this will
7+
give you access to DenoGres's CLI functionality.
8+
9+
> `deno install --allow-read --allow-write --allow-net --allow-env --allow-run --name denogres https://deno.land/x/denogres/mod.ts`
710
811
After installation is complete, ensure deno is added to PATH.
912

13+
## Quick Start
14+
15+
Before using DenoGres in a project, run the command below.
16+
17+
> `denogres --init`
18+
19+
This will create the following in your project's root directory:
20+
21+
- .env file for your database connection URI
22+
- a models folder for your model.ts file
23+
- a Migrations folder for migration logs and model snapshots
24+
25+
After running the init command, update the .env file to contain your database's
26+
connection URI.
27+
28+
> `DATABASE_URI=driver://user:password@host:port/database_name`
29+
30+
With all the set-up steps complete, you're ready to introspect your database!
31+
Database introspection will automatically create TypeScript models of your
32+
database tables in the .models/model.ts file.
33+
34+
> `denogres --db-pull`
35+
36+
## Synchronizing your Database
37+
38+
Denogres features bi-directional synchronization that is designed to ensure that
39+
your database schema and your project Models in full alignment, maintaining a
40+
single, consistent source of truth.
41+
42+
To introspect and generate the associated models within the model.ts file,
43+
execute the the following CLI command:
44+
45+
> `denogres --db-pull`
46+
47+
In addition to --db-pull, Denogres also includes --db-sync functionality that
48+
will revise the PostgreSQL schema to reflect changes within the DenoGres
49+
model.ts file.
50+
51+
Once completed changes to your model have been made, execute the following CLI
52+
command:
53+
54+
> `denogres --db-sync`
55+
56+
## Seeding Your Database
57+
58+
DenoGres allows data to be populated to the PostgreSQL schema through data
59+
seeding. This is primarily useful during database design/development (i.e. an
60+
application requires a certain amount of data to function properly) Create a
61+
seed.ts within the project root directory, and execute the following CLI
62+
command:
1063

11-
## Using DenoGres
12-
Before using DenoGres in a project, run the below.
13-
In your project's root directory, a .env file, for your database connection URI, and a models folder, for your model.ts file, will be created.
14-
>`denogres --init`
64+
> `denogres --db-seed`
1565
16-
After running the init command, update the .env file to contain your database's connection URI.
17-
>`DATABASE_URI=driver://user:password@host:port/database_name`
66+
The associated database schema will be pre-populated based on the user's seed.ts
67+
file.
1868

19-
With all the set-up steps complete, you're ready to introspect your database! Database introspection will automatically create TypeScript models of your database tables in the .models/model.ts file.
20-
>`denogres --db-pull`
69+
## Navigating the GUI
2170

22-
### Under Development
23-
DenoGres includes some functionality that is still in development - including database sync functionality. The sync functionality:
24-
* Identifies instances within the models/model.ts file where user updates have caused the database and TypeScript models to be out-of-sync
25-
* Creates and executes queries to update the database so all points of reference once again align
26-
>`denogres --db-sync`
71+
DenoGres includes a GUI that allows the user to test and run queries utilizing
72+
generated Models and associated methods. Furthermore, users can save database
73+
connections and previous queries to their accounts for later access.
2774

28-
## Documents
29-
More information on how to use DenoGres and leverage all its wonderful abstraction functionality can be found here: https://denogres.deno.dev/
75+
Launch the DenoGres GUI by running the following CLI command:
76+
77+
> `denogres --gui`
78+
79+
## Migration Logs and Restore
80+
81+
Any time a user opts to make a request for --db-pull or --db-sync, Denogres
82+
maintains a record of that request so that users can refer back to those
83+
historical records. Additionally, users can opt to restore the Model/database
84+
schema to prior iterations, in instances where users would like to roll
85+
back/forward changes that have been made.
86+
87+
To see a historical list of migration logs, execute the following CLI command:
88+
89+
> `denogres --log`
90+
91+
To restore Models to a prior version, execute the following CLI command:
92+
93+
> `denogres --restore [PREVIOUS_MODEL_FOLDER]`
94+
95+
## Under Development
96+
97+
DenoGres is continually evolving. Features currently in development include:
98+
99+
- Database sync method (`denogres --db-sync`) will account for multiple
100+
associations and composite unique keys.
101+
- "Compare" command (`denogres --compare`) will be implemented to display
102+
side-by-side diff between previous models.
103+
- Migrations log will be visible within the GUI, so that users can
104+
track/view/compare model versions.
105+
- ERD-style diagrams will be generated within the GUI, so users can have a
106+
comprehensive view of the data model.
107+
- Additional support for MySQL, SQL Server, etc.
108+
109+
## Documentation
110+
111+
More information on how to use DenoGres and leverage all its wonderful
112+
abstraction functionality can be found here: https://denogres.deno.dev/
113+
114+
## Contributors
115+
116+
### Version 2.0
117+
118+
- Anthony Lo | [GitHub](https://github.com/anthonylo87) |
119+
[LinkedIn](https://linkedin.com/in/87anthonylo/)
120+
- Henry Park | [GitHub](https://github.com/CodeDenma) |
121+
[LinkedIn](https://linkedin.com/in/henrytpark/)
122+
- Carlos Villarreal | [GitHub](https://github.com/Jiggyloww) |
123+
[LinkedIn](https://linkedin.com/in/carlosvillarrealsb)
124+
- Eddie Wu | [GitHub](https://github.com/edi-wu) |
125+
[LinkedIn](https://linkedin.com/in/edi-wu)
126+
127+
### Version 1.0
128+
129+
- Ben Engelberg | [GitHub](https://github.com/bengelberg) |
130+
[LinkedIn](https://linkedin.com/in/benengelberg)
131+
- Moonhee Hur | [GitHub](https://github.com/mhurcs) |
132+
[LinkedIn](https://linkedin.com/in/moonheehur)
133+
- Tesia Hwang | [GitHub](https://github.com/tesiahwang) |
134+
[LinkedIn](https://linkedin.com/in/tesia-hwang)
135+
- Kristen Lu | [GitHub](https://github.com/kristenlu24) |
136+
[LinkedIn](https://linkedin.com/in/kristen-lu)
137+
- Allison Roderiques | [GitHub](https://github.com/allirod) |
138+
[LinkedIn](https://linkedin.com/in/allison-roderiques)
30139

31140
## License
141+
32142
MIT

Test/dbPull.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { assert } from './deps.ts';
22
import { dbPull } from '../src/functions/dbPull.ts';
33

44
const generatedModel =
5+
// `import { Model } from 'https://deno.land/x/denogresdev/mod.ts'
56
`import { Model } from 'https://deno.land/x/denogres/mod.ts'
67
// user model definition comes here
78

0 commit comments

Comments
 (0)