Comments (4)
We can define these as mixins, which drift will consider if applied to a table, e.g
mixin DateColumns on Table {
DateTimeColumn get createdAt => dateTime().default(currentDateAndTime)();
}
Dealing with updatedAt
is more complicated of course, I usually advice using triggers but I'm not sure if something that invasive should be a simple thing to apply.
from drift.
Well, I wanted to ignore this and just live with the fact that I couldn't have a simple updatedAt column but this was just a week ago so I may as well ask it
I'd honestly love having updatedAt/deletedAt as a simple-to-apply strategy, they are both really useful and a lot of ORMs implement them. Emphasis on the deletedAt though, as it was not mentioned in the original post
Thus being said, if I may be a little greedy, it'd be wonderful if, not only it'd be simple to apply, but also being able to soft delete a row with a simple boolean + the select doesn't count soft deleted (if not explicitely stated)
from drift.
deletedAt
sounds like a really smart idea, but It's out of scope for an ORM, which Drift aims to be.
Even the Django ORM, which borders on being a "Data Framework", doesn't have such a feature.
I love the idea though. It's sick.
from drift.
Yes i get what you're saying, I've "had" the idea from GORM, I didn't even need it but at that point that was just too cool to not use :)
from drift.
Related Issues (20)
- Improve performance of `InsertStatement.createContext` in batches HOT 1
- Potential OOM error on both Android & iOS HOT 8
- Why DOES THIS PACKAGE NOT WORK HOT 2
- SQLite - Migrator Bug? Regression from 2.18.0 => 2.19.x when adding nullable columns to table with data HOT 17
- Web WASM: "RuntimeError: illegal cast at DriftCommunication._handleMessage" HOT 7
- Error generate table with name "xxxus" HOT 3
- Add easy isolate-shared NativeDatabases HOT 4
- Client Check HOT 4
- GroupBy DateTime month not working as expected HOT 2
- Name Clashing to use `Value`
- Please allow @TableIndex to be used on mixins HOT 2
- Don't generate tables for abstract class derivatives of Table HOT 3
- App Binary size extremly expanded after upgrade drfit HOT 2
- Having two "autoincrement" integers breaks the insert Companion HOT 1
- Error: The argument type 'Object?' can't be assigned to the parameter type 'Expression<int>' HOT 3
- DateTimeColumn values are always returned as local time, timezone/UTC gets lost HOT 6
- Generation Errors When Using 'Address' As Table Name HOT 1
- Got UI stuck when writting data to SQL HOT 7
- Allow using `getApplicationSupportDirectory` instead of `getApplicationDocumentsDirectory` in drift_flutter HOT 1
- [Documentation] Add warnings about common migration problems HOT 4
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 drift.