Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve restore db #34

Merged
merged 5 commits into from
Mar 2, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,15 @@ dump:

restore:
@echo restoring DB from file `ls -t backup/*.sql.tar | head -1`
# retrieve commit number and checkout
git checkout $(shell ls -t backup/*.sql.tar | head -1 | cut -d'-' -f4 | cut -d '.' -f1)

# restore DB
docker-compose -f docker-compose-dev.yml run --rm \
-v $(shell pwd)/backup/:/backup \
postgres sh -c 'exec pg_restore -c -hpostgres -U${DATABASE_USER} -Ox -Ft -d${DB_NAME} `ls -t /backup/*.sql.tar | head -1`'

# restart web container
make restart-web

release:
Expand Down
10 changes: 8 additions & 2 deletions infoscience_exports/exports/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,14 @@
admin.site.__class__ = TequilaAdminSite


class EPFLUserModelAdmin(UserAdmin):
list_display = ('username', 'email', 'last_login', 'is_superuser')


class ExportLoggedModelAdmin(LoggedModelAdminMixin, ModelAdmin):
pass
list_display = ('name', 'user', 'updated_at')
list_filter = ('updated_at', )


admin.site.register(Export, ExportLoggedModelAdmin)
admin.site.register(User, UserAdmin)
admin.site.register(User, EPFLUserModelAdmin)
2 changes: 1 addition & 1 deletion infoscience_exports/exports/models/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class Export(BulletsSettings,
ThumbnailSettings,
LinksSettings,
GroupBySettings,
FormatsSettings,
FormatsSettings,
models.Model,
DirtyFieldsMixin,
):
Expand Down
3 changes: 3 additions & 0 deletions infoscience_exports/exports/models/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ class User(AbstractUser):
classe = models.CharField(max_length=100, null=True, blank=True)
statut = models.CharField(max_length=100, null=True, blank=True)

def __str__(self):
return self.email

def __unicode__(self):
return """ Sciper: %s
where: %s
Expand Down
2 changes: 2 additions & 0 deletions infoscience_exports/exports/test/locustfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
def increment():
increment.i += 1
return increment.i


increment.i = 0


Expand Down
6 changes: 3 additions & 3 deletions infoscience_exports/exports/versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@

# the release comes from git and should not be modified
# => read-only
_release = '0.2.3-12-g087d327'
_release = '0.2.4-6-gcb346d1'

# you can set the next version number manually
# if you do not, the system will make sure that version > release
# => read-write, >_release
_version = '0.2.4'
_version = '0.2.5-rc'

# the build number will generate conflicts on each PR merge
# just keep yours every time
# => read-only
_build = '087d3277e331e10c958860dfe2e049bba40ab05a'
_build = 'cb346d1c9b57fe461ae8ae43467c25ea5ef371d7'