snap-cloud / snapCloud

Official cloud backend and community site for the Snap! programming language
https://snap.berkeley.edu/
GNU General Public License v3.0
52 stars 28 forks source link

Don't actually delete projects #169

Closed bromagosa closed 5 years ago

bromagosa commented 5 years ago

I've decided to add a deleted timestamp column. I've been running some benchmarks in staging and it doesn't add too much overhead to test whether an additional column is null. We could even create a view that filters deleted projects automatically and always query from that one except when specifically looking for deleted projects:

create view active_projects as select * from projects where deleted is null; create view deleted_projects as select * from projects where deleted is not null;

This will make it much easier for remixes, as it won't break any existing relationships.

cycomachead commented 5 years ago

Can we name the column deleted_at? Otherwise, it seems like deleted is probably a boolean.

bromagosa commented 5 years ago

Hmm, we can, but I was just following the same names as created, lastshared, etc.

cycomachead commented 5 years ago

I think we should name those with _at too. Especially since there's some useful features in lapis: http://leafo.net/lapis/reference/models.html#timestamps

bromagosa commented 5 years ago

Agreed. I'll close this one though, as it's already implemented in 78679cc. We can rename these columns later :)

I'm amazed at how easy it was to do this, by the way. Views are very useful.

cycomachead commented 5 years ago

Views are indeed cool! I really like that solution.

The other cool thing is that those views also will show up in metabase, too.

Michael Ball | michaelball.co UC Berkeley Computer Science BA '15, MS '16 gradescope.com | bjc.berkeley.edu

On Mon, Jan 14, 2019 at 2:56 AM Bernat Romagosa notifications@github.com wrote:

Agreed. I'll close this one though, as it's already implemented in 78679cc https://github.com/bromagosa/snapCloud/commit/78679cc4d71418b78351b8f225ae97948bafde77. We can rename these columns later :)

I'm amazed at how easy it was to do this, by the way. Views are very useful.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/bromagosa/snapCloud/issues/169#issuecomment-453966153, or mute the thread https://github.com/notifications/unsubscribe-auth/ABb6c1m42cWMe27UUGMLHpoRjcW7eHujks5vDGJAgaJpZM4Z99sf .