Giter Site home page Giter Site logo

hannesrammer / dartabase Goto Github PK

View Code? Open in Web Editor NEW
35.0 35.0 6.0 9.99 MB

Database (Rails like) migration and model (ORM CRUD) and code generator (Scaffolding) tool working with MYSQL and PGSQL in Dart without having to write SQL

License: BSD 2-Clause "Simplified" License

Dart 71.74% HTML 28.26%

dartabase's People

Contributors

hannesrammer avatar rightisleft avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

dartabase's Issues

speed tests!!

testApp to
x=1.000.000 || 10.000.000 || 100.000.000
1.insert x objects in db (user:20%, picture:20%, comments:60%)

2.use with data > x db lines

3.delete all objects

Migration: implement GUI

implement GUI for handling all your Dartabase

  • project settings
  • migration
  • scaffolding (will come in v >= 0.7.0)

License?

This is a great project -- I just started using Dart and was lamenting the fact that I had to write SQL by hand for the first time in several years. Dartabase looks like a very promising alternative.

Would you consider putting a license up, assuming this is an open source project?

Hopefully you'll consider licensing it under similar terms as Dart itself (BSD or similar).

Model: delete/remove dependency relations

1, 2 or 3

User->picture->comment

  1. via model (slower?)
    find picture
    find all comments
    remove/delete each comment
    remove/delete picture
    delete user

2.joint tables with only user.id (fastest?but most complex)
one sql with join tables

3.joint tables with user.id, picture.id, comment.ids (MIX)
get object ids and then create join table
three sql (one for each object type (user picture comment))

fix wired bug in dbUp and dbDown

when dbUp dbDown are started it seems that the listener waiting for input for some wired reason recieves the absolute path to dart.exe without any manual input..

either its some changes in steams with Dart version 1.4 or maybe a print after listen starts is taken as input by mistake

Model: create->delete->update tweak

so far only tested with MySQL

enter test data with id 1 and id 2
remove where id 1
update data where id=1
wont do anything.

thoughts:check whats most appropriate also fix console output log
-create new object with id 3 or recreate an object with id=1
-if manual_id !existInTable && manual_id < generated_id (if deleted o)

Model: too many connections

while implementing todo list example errors
too many db connections at once in pgsql
check with mysql if problem is adapter specific

using max 5 connections

guessing
async loop querying db faster than connection can open and close

thoughts
maybe keep connections open instead of opening and closing for each query.

Permission Error

Trying to follow along with the Dartabase tutorials.

When i get to the dbinit steps i get the following error:

➜ bin git:(todolist) dart dbInit.dart
Dartabase initiation
--------------------------

!!ONLY RUN THIS ONCE FOR EACH PROJECT!!

Please type or paste a project name and press the ENTER key
todo
Please enter the absolute path to your project root folder and press the ENTER key to proceed
eg. c:\DartProjects\myApp
take care of capital letters!!
/Users/jmurphy/projects/DartabaseTutorials/examples/PreTutorialMixApp
add project mapping todo:/Users/jmurphy/projects/DartabaseTutorials/examples/PreTutorialMixApp
created directory /Users/jmurphy/projects/DartabaseTutorials/examples/PreTutorialMixApp/db/migrations
creating /Users/jmurphy/projects/DartabaseTutorials/examples/PreTutorialMixApp/db/config.json
creating /Users/jmurphy/projects/DartabaseTutorials/examples/PreTutorialMixApp/db/schema.json
creating /Users/jmurphy/projects/DartabaseTutorials/examples/PreTutorialMixApp/db/schemaVersion.json

add project mapping todo:
Unhandled exception:
Uncaught Error: FileSystemException: Creation failed, path = '/db' (OS Error: Permission denied, errno = 13)
Stack Trace:
#0 _Directory.create. (dart:io/directory_impl.dart:108)
#1 _RootZone.runUnary (dart:async/zone.dart:1155)
#2 _Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:484)
#3 _Future._propagateToListeners (dart:async/future_impl.dart:567)
#4 _Future._completeWithValue (dart:async/future_impl.dart:358)
#5 _Future._asyncComplete. (dart:async/future_impl.dart:412)
#6 _asyncRunCallbackLoop (dart:async/schedule_microtask.dart:41)
#7 _asyncRunCallback (dart:async/schedule_microtask.dart:48)
#8 _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:84)
#9 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:131)
#0 _rootHandleUncaughtError. (dart:async/zone.dart:886)
#1 _asyncRunCallbackLoop (dart:async/schedule_microtask.dart:41)
#2 _asyncRunCallback (dart:async/schedule_microtask.dart:48)
#3 _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:84)
#4 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:131)

When i look at the target folder i see the following:

➜ db git:(tutorial) ✗ pwd
/Users/jmurphy/projects/DartabaseTutorials/examples/PreTutorialMixApp/db
➜ db git:(tutorial) ✗ tree
.
├── config.json
├── migrations
├── schema.json
└── schemaVersion.json

1 directory, 3 files

Migration: add optional options for column creation

instead of

"createTable": {
"account": {
"balance": "INT"
}
}

make this possible

"createTable": {
"account": {
"balance": {
"type":"INT"
}
}
}

options will be added in future version
currently only focus on implementation with hash

Model: add additional options for column creation

now that migration supports column options

think about options!!!!

currently only 'type':'DARTABASETYPE' exists

eg
default value
'default': null/0/""/'2013.12.13 00:00'

max column size
'max/size/length' : "255"

not null
'null':'false'

Migration: autogenerate dart model from database schema for existing projects

autogenerate dart server side model from database schema to enable existing projects an easy use dartabase

allows to reuse existing databases when porting to dart or on existing dart projects to simplify adaption
rails app -> generate dart models from db

part of example.server;
class ${className} extends Model{
num id; // database column autogenerated by migration
${generatedynamicFields("serverVars", columnsMap)}
DateTime created_at; // database column autogenerated by migration
DateTime updated_at; // database column autogenerated by migration

String toString() => "${className} id=$id:${toStringParts.join(":")}:created_at:$created_at:updated_at:$updated_at";

}

Dynamic Server path genetation

think about adding newly generated scaffold post and get calls for model via magic words

Or

Use dynamic Server post and get Funktion that works like rails using routes combined with function

Maybe :controller :action :id Item.loadItems()

think about "has many" "belongs to" implementation

MIGRATION

where to add columns
author - has many - books (1-) author_id in book table or 3rd table author_to_books
book - belongs to - author (1-1) author_id in book table
book - has many - authors (1-
) author_id in book table or 3rd table author_to_books
books - have many - authors (-) 3rd table author_to_books

automatic or manual generation
automatic
user adds column option "hasMany":"table_name" in migration
manual
user creates table "table_name_a_table_name_b" via standart way

additional option might be setting max number of hasMany
eg max 5 pictures per profile

MODEL

maybe instead of hasMany belongsTo only "has" and dependend on
author.has("book").then((books){

});
book.has("author").then((authors){

});

think about
schema and all dependent functions/scripts eg createMigration.dart

Migration: implement scaffolding

run scaffold will initiate console for simple code generation
1.enter table_name
repeat start
2.enter attribute -> will show list with of supported dartabasetypes
3.select type
repeat stop
will generate
-standart migration file "yyyymmddhhmmss_create_table_name.yml"
-item model file "bin/tableName.dart"

additionally choice to generate client code
basic files poly/angular/html/. starting with polymer code like in PostTutorialMixApp
(think about using poly Version <1 or waiting for poly version > 1)

implement tutorial

Write a tutorial including example code to demonstrate setting up a project consisting of 'simple server' and a simple polymer 'todo list' client

Migration

  1. download migration (once)
  2. initiate project with migration (once)
  3. update database project config file with your info (once)
  4. create migration files for your project
  5. generate database structure from migration files

Model
6. initiate dartabase model with project(once)
7. update database object server files with ID CreatedAt UpdatedAt
8. save load relate delete database data via dartabase

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.