Comments (6)
Yes, I would really like to see something like that. Ideally I’d like to see it if it didn’t result in any failing specs.
The current idea with dm-constraints is we set up software level constraints, that if working perfectly should catch all attempts to destroy a resource when it has dependents. The DB level constraints are more of a safety net, as well as communicating intent, and also providing a backup for if (when) the DB becomes an integration point.
by Dan Kubb (dkubb)
from dm-constraints.
I’d just like to say that I would love to see this functionality merged into dm-constraints. I believe newer versions of SQLite 3 even support FK constraints too.
If some of this functionality included CHECK constraints I would be doubly excited to see it merged in :)
by Dan Kubb (dkubb)
from dm-constraints.
@solnic and @dkubb : any news or plans on the sqlite3 constraints support? I would really to get this functionality working since I would like to port an ugly sqlite3 generation scripts to datamapper but I really need the db-level constraints since the db is used in an un-ruby ecosystem…
I could help to get the things done.
from dm-constraints.
@nibua-r if you wanted to take a stab at it, there's a good chance it might represent a few minutes to make the code changes, and perhaps an hour or two of testing for someone sufficiently motivated.
The basic approach would be to modify the SQLite adapter within dm-constraints so it returns true for versions of SQlite3 that provide FK constraint support. See dm-migrations for the methods we have built-in for getting the DB version.
from dm-constraints.
@dkubb I have delayed my response to take (a little) time to check the code and I'm sorry for that.
I'll report here as soon as I can take some time to get a first version.
from dm-constraints.
@dkubb Wow, I forgot about that issue… Now, the need is back again!
After a quick glance on the dm-constraints
source code (i.e. DataObjectsAdapter), all I could say is that the basic approach would fail. SQLite doesn't support ALTER TABLE … ADD CONSTRAINT
(SQL Features That SQLite Does Not Implement) and as a consequence, it is not possible to add the constraints after the table creation, thus to use the actual methods.
Is there a way to append the relationship constraints to the CREATE TABLE
statement?
from dm-constraints.
Related Issues (7)
- Quoting of name on mysql HOT 2
- auto migrate fails with belongs_to HOT 3
- constraints hooks always runs first HOT 1
- dm-constraints does not load models correct to infer key
- Let dm-constraints support SQLite > 3.6.19 or 3.7
- DataMapper doesn't create unique indices for subclassed models and potentially handles notnull constraints wrong HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dm-constraints.