Skip to content

Commit c7883cd

Browse files
committed
Updates migrations
To get the app working again I ran resetdb, let it crash in initdb, then ran the migration, then re-ran initdb
1 parent d1f1260 commit c7883cd

File tree

106 files changed

+279
-279
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

106 files changed

+279
-279
lines changed

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,13 @@ You will need postgres installed and running on your computer.
6666
python3 -m venv venv
6767
source venv/bin/activate
6868
pip install -r requirements.txt
69-
createdb fedireads
69+
createdb bookwyrm
7070
```
7171

72-
Create the psql user in `psql fedireads`:
72+
Create the psql user in `psql bookwyrm`:
7373
``` psql
74-
CREATE ROLE fedireads WITH LOGIN PASSWORD 'fedireads';
75-
GRANT ALL PRIVILEGES ON DATABASE fedireads TO fedireads;
74+
CREATE ROLE bookwyrm WITH LOGIN PASSWORD 'bookwyrm';
75+
GRANT ALL PRIVILEGES ON DATABASE bookwyrm TO bookwyrm;
7676
```
7777

7878
Initialize the database (or, more specifically, delete the existing database, run migrations, and start fresh):

bookwyrm/activitypub/person.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class Person(ActivityObject):
1616
publicKey: PublicKey
1717
endpoints: Dict
1818
icon: Image = field(default=lambda: {})
19-
fedireadsUser: str = False
19+
bookwyrmUser: str = False
2020
manuallyApprovesFollowers: str = False
2121
discoverable: str = True
2222
type: str = 'Person'

bookwyrm/books_manager.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
from requests import HTTPError
66

7-
from fedireads import models
8-
from fedireads.tasks import app
7+
from bookwyrm import models
8+
from bookwyrm.tasks import app
99

1010

1111
def get_edition(book_id):
@@ -43,7 +43,7 @@ def get_or_create_connector(remote_id):
4343
except models.Connector.DoesNotExist:
4444
connector_info = models.Connector.objects.create(
4545
identifier=identifier,
46-
connector_file='fedireads_connector',
46+
connector_file='bookwyrm_connector',
4747
base_url='https://%s' % identifier,
4848
books_url='https://%s/book' % identifier,
4949
covers_url='https://%s/images/covers' % identifier,
@@ -115,6 +115,6 @@ def get_connectors():
115115
def load_connector(connector_info):
116116
''' instantiate the connector class '''
117117
connector = importlib.import_module(
118-
'fedireads.connectors.%s' % connector_info.connector_file
118+
'bookwyrm.connectors.%s' % connector_info.connector_file
119119
)
120120
return connector.Connector(connector_info.identifier)

bookwyrm/broadcast.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@
33
from django.utils.http import http_date
44
import requests
55

6-
from fedireads import models
7-
from fedireads.activitypub import ActivityEncoder
8-
from fedireads.tasks import app
9-
from fedireads.signatures import make_signature, make_digest
6+
from bookwyrm import models
7+
from bookwyrm.activitypub import ActivityEncoder
8+
from bookwyrm.tasks import app
9+
from bookwyrm.signatures import make_signature, make_digest
1010

1111

1212
def get_public_recipients(user, software=None):
1313
''' everybody and their public inboxes '''
1414
followers = user.followers.filter(local=False)
1515
if software:
1616
# TODO: eventually we may want to handle particular software differently
17-
followers = followers.filter(fedireads_user=(software == 'fedireads'))
17+
followers = followers.filter(bookwyrm_user=(software == 'bookwyrm'))
1818

1919
# we want shared inboxes when available
2020
shared = followers.filter(

bookwyrm/connectors/abstract_connector.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
from django.db import transaction
88

9-
from fedireads import models
9+
from bookwyrm import models
1010

1111

1212
class AbstractConnector(ABC):

bookwyrm/connectors/fedireads_connector.py bookwyrm/connectors/bookwyrm_connector.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
''' using another fedireads instance as a source of book data '''
1+
''' using another bookwyrm instance as a source of book data '''
22
from uuid import uuid4
33

44
from django.core.exceptions import ObjectDoesNotExist
55
from django.core.files.base import ContentFile
66
import requests
77

8-
from fedireads import models
8+
from bookwyrm import models
99
from .abstract_connector import AbstractConnector, SearchResult, Mapping
1010
from .abstract_connector import update_from_mappings, get_date, get_data
1111

bookwyrm/connectors/openlibrary.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
from django.core.files.base import ContentFile
66

7-
from fedireads import models
7+
from bookwyrm import models
88
from .abstract_connector import AbstractConnector, SearchResult, Mapping
99
from .abstract_connector import update_from_mappings
1010
from .abstract_connector import get_date, get_data

bookwyrm/connectors/self_connector.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
''' using a fedireads instance as a source of book data '''
1+
''' using a bookwyrm instance as a source of book data '''
22
from django.contrib.postgres.search import SearchRank, SearchVector
33

4-
from fedireads import models
4+
from bookwyrm import models
55
from .abstract_connector import AbstractConnector, SearchResult
66

77

@@ -12,7 +12,7 @@ def __init__(self, identifier):
1212

1313

1414
def search(self, query):
15-
''' right now you can't search fedireads sorry, but when
15+
''' right now you can't search bookwyrm sorry, but when
1616
that gets implemented it will totally rule '''
1717
vector = SearchVector('title', weight='A') +\
1818
SearchVector('subtitle', weight='B') +\

bookwyrm/connectors/settings.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
''' settings book data connectors '''
22

3-
CONNECTORS = ['openlibrary', 'self_connector', 'fedireads_connector']
3+
CONNECTORS = ['openlibrary', 'self_connector', 'bookwyrm_connector']

bookwyrm/forms.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from django.forms import ModelForm, PasswordInput, widgets
66
from django import forms
77

8-
from fedireads import models
8+
from bookwyrm import models
99

1010

1111
class LoginForm(ModelForm):

bookwyrm/goodreads_import.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
import csv
33
from requests import HTTPError
44

5-
from fedireads import outgoing
6-
from fedireads.tasks import app
7-
from fedireads.models import ImportJob, ImportItem
8-
from fedireads.status import create_notification
5+
from bookwyrm import outgoing
6+
from bookwyrm.tasks import app
7+
from bookwyrm.models import ImportJob, ImportItem
8+
from bookwyrm.status import create_notification
99

1010
# TODO: remove or increase once we're confident it's not causing problems.
1111
MAX_ENTRIES = 500

bookwyrm/incoming.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
from django.views.decorators.csrf import csrf_exempt
99
import requests
1010

11-
from fedireads import activitypub, books_manager, models, outgoing
12-
from fedireads import status as status_builder
13-
from fedireads.remote_user import get_or_create_remote_user, refresh_remote_user
14-
from fedireads.tasks import app
15-
from fedireads.signatures import Signature
11+
from bookwyrm import activitypub, books_manager, models, outgoing
12+
from bookwyrm import status as status_builder
13+
from bookwyrm.remote_user import get_or_create_remote_user, refresh_remote_user
14+
from bookwyrm.tasks import app
15+
from bookwyrm.signatures import Signature
1616

1717

1818
@csrf_exempt

bookwyrm/migrations/0001_initial.py

+15-15
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from django.db import migrations, models
88
import django.db.models.deletion
99
import django.utils.timezone
10-
import fedireads.utils.fields
10+
import bookwyrm.utils.fields
1111

1212

1313
class Migration(migrations.Migration):
@@ -62,7 +62,7 @@ class Migration(migrations.Migration):
6262
('content', models.TextField(blank=True, null=True)),
6363
('created_date', models.DateTimeField(auto_now_add=True)),
6464
('openlibrary_key', models.CharField(max_length=255)),
65-
('data', fedireads.utils.fields.JSONField()),
65+
('data', bookwyrm.utils.fields.JSONField()),
6666
],
6767
options={
6868
'abstract': False,
@@ -75,10 +75,10 @@ class Migration(migrations.Migration):
7575
('content', models.TextField(blank=True, null=True)),
7676
('created_date', models.DateTimeField(auto_now_add=True)),
7777
('openlibrary_key', models.CharField(max_length=255, unique=True)),
78-
('data', fedireads.utils.fields.JSONField()),
78+
('data', bookwyrm.utils.fields.JSONField()),
7979
('cover', models.ImageField(blank=True, null=True, upload_to='covers/')),
8080
('added_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL)),
81-
('authors', models.ManyToManyField(to='fedireads.Author')),
81+
('authors', models.ManyToManyField(to='bookwyrm.Author')),
8282
],
8383
options={
8484
'abstract': False,
@@ -120,9 +120,9 @@ class Migration(migrations.Migration):
120120
('local', models.BooleanField(default=True)),
121121
('privacy', models.CharField(default='public', max_length=255)),
122122
('sensitive', models.BooleanField(default=False)),
123-
('mention_books', models.ManyToManyField(related_name='mention_book', to='fedireads.Book')),
123+
('mention_books', models.ManyToManyField(related_name='mention_book', to='bookwyrm.Book')),
124124
('mention_users', models.ManyToManyField(related_name='mention_user', to=settings.AUTH_USER_MODEL)),
125-
('reply_parent', models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, to='fedireads.Status')),
125+
('reply_parent', models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, to='bookwyrm.Status')),
126126
('user', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL)),
127127
],
128128
options={
@@ -151,8 +151,8 @@ class Migration(migrations.Migration):
151151
('content', models.TextField(blank=True, null=True)),
152152
('created_date', models.DateTimeField(auto_now_add=True)),
153153
('added_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL)),
154-
('book', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='fedireads.Book')),
155-
('shelf', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='fedireads.Shelf')),
154+
('book', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='bookwyrm.Book')),
155+
('shelf', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='bookwyrm.Shelf')),
156156
],
157157
options={
158158
'unique_together': {('book', 'shelf')},
@@ -161,7 +161,7 @@ class Migration(migrations.Migration):
161161
migrations.AddField(
162162
model_name='shelf',
163163
name='books',
164-
field=models.ManyToManyField(through='fedireads.ShelfBook', to='fedireads.Book'),
164+
field=models.ManyToManyField(through='bookwyrm.ShelfBook', to='bookwyrm.Book'),
165165
),
166166
migrations.AddField(
167167
model_name='shelf',
@@ -171,17 +171,17 @@ class Migration(migrations.Migration):
171171
migrations.AddField(
172172
model_name='book',
173173
name='shelves',
174-
field=models.ManyToManyField(through='fedireads.ShelfBook', to='fedireads.Shelf'),
174+
field=models.ManyToManyField(through='bookwyrm.ShelfBook', to='bookwyrm.Shelf'),
175175
),
176176
migrations.AddField(
177177
model_name='user',
178178
name='federated_server',
179-
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, to='fedireads.FederatedServer'),
179+
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, to='bookwyrm.FederatedServer'),
180180
),
181181
migrations.AddField(
182182
model_name='user',
183183
name='followers',
184-
field=models.ManyToManyField(through='fedireads.UserRelationship', to=settings.AUTH_USER_MODEL),
184+
field=models.ManyToManyField(through='bookwyrm.UserRelationship', to=settings.AUTH_USER_MODEL),
185185
),
186186
migrations.AddField(
187187
model_name='user',
@@ -200,14 +200,14 @@ class Migration(migrations.Migration):
200200
migrations.CreateModel(
201201
name='Review',
202202
fields=[
203-
('status_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='fedireads.Status')),
203+
('status_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='bookwyrm.Status')),
204204
('name', models.CharField(max_length=255)),
205205
('rating', models.IntegerField(default=0, validators=[django.core.validators.MinValueValidator(0), django.core.validators.MaxValueValidator(5)])),
206-
('book', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='fedireads.Book')),
206+
('book', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='bookwyrm.Book')),
207207
],
208208
options={
209209
'abstract': False,
210210
},
211-
bases=('fedireads.status',),
211+
bases=('bookwyrm.status',),
212212
),
213213
]

bookwyrm/migrations/0002_auto_20200219_0816.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
class Migration(migrations.Migration):
99

1010
dependencies = [
11-
('fedireads', '0001_initial'),
11+
('bookwyrm', '0001_initial'),
1212
]
1313

1414
operations = [
@@ -18,7 +18,7 @@ class Migration(migrations.Migration):
1818
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
1919
('content', models.TextField(blank=True, null=True)),
2020
('created_date', models.DateTimeField(auto_now_add=True)),
21-
('status', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='fedireads.Status')),
21+
('status', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='bookwyrm.Status')),
2222
('user', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL)),
2323
],
2424
options={
@@ -28,11 +28,11 @@ class Migration(migrations.Migration):
2828
migrations.AddField(
2929
model_name='status',
3030
name='favorites',
31-
field=models.ManyToManyField(related_name='user_favorites', through='fedireads.Favorite', to=settings.AUTH_USER_MODEL),
31+
field=models.ManyToManyField(related_name='user_favorites', through='bookwyrm.Favorite', to=settings.AUTH_USER_MODEL),
3232
),
3333
migrations.AddField(
3434
model_name='user',
3535
name='favorites',
36-
field=models.ManyToManyField(related_name='favorite_statuses', through='fedireads.Favorite', to='fedireads.Status'),
36+
field=models.ManyToManyField(related_name='favorite_statuses', through='bookwyrm.Favorite', to='bookwyrm.Status'),
3737
),
3838
]

bookwyrm/migrations/0003_auto_20200221_0131.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
class Migration(migrations.Migration):
88

99
dependencies = [
10-
('fedireads', '0002_auto_20200219_0816'),
10+
('bookwyrm', '0002_auto_20200219_0816'),
1111
]
1212

1313
operations = [

bookwyrm/migrations/0004_tag.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
class Migration(migrations.Migration):
99

1010
dependencies = [
11-
('fedireads', '0003_auto_20200221_0131'),
11+
('bookwyrm', '0003_auto_20200221_0131'),
1212
]
1313

1414
operations = [
@@ -19,7 +19,7 @@ class Migration(migrations.Migration):
1919
('created_date', models.DateTimeField(auto_now_add=True)),
2020
('updated_date', models.DateTimeField(auto_now=True)),
2121
('name', models.CharField(max_length=140)),
22-
('book', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='fedireads.Book')),
22+
('book', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='bookwyrm.Book')),
2323
('user', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL)),
2424
],
2525
options={

bookwyrm/migrations/0005_auto_20200221_1645.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
def populate_identifiers(app_registry, schema_editor):
77
db_alias = schema_editor.connection.alias
8-
tags = app_registry.get_model('fedireads', 'Tag')
8+
tags = app_registry.get_model('bookwyrm', 'Tag')
99
for tag in tags.objects.using(db_alias):
1010
tag.identifier = re.sub(r'\W+', '-', tag.name).lower()
1111
tag.save()
@@ -14,7 +14,7 @@ def populate_identifiers(app_registry, schema_editor):
1414
class Migration(migrations.Migration):
1515

1616
dependencies = [
17-
('fedireads', '0004_tag'),
17+
('bookwyrm', '0004_tag'),
1818
]
1919

2020
operations = [

bookwyrm/migrations/0006_auto_20200221_1702.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
class Migration(migrations.Migration):
77

88
dependencies = [
9-
('fedireads', '0005_auto_20200221_1645'),
9+
('bookwyrm', '0005_auto_20200221_1645'),
1010
]
1111

1212
operations = [

bookwyrm/migrations/0007_auto_20200223_0902.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
class Migration(migrations.Migration):
77

88
dependencies = [
9-
('fedireads', '0006_auto_20200221_1702'),
9+
('bookwyrm', '0006_auto_20200221_1702'),
1010
]
1111

1212
operations = [

bookwyrm/migrations/0008_auto_20200224_1504.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77
class Migration(migrations.Migration):
88

99
dependencies = [
10-
('fedireads', '0007_auto_20200223_0902'),
10+
('bookwyrm', '0007_auto_20200223_0902'),
1111
]
1212

1313
operations = [
1414
migrations.AlterField(
1515
model_name='user',
1616
name='followers',
17-
field=models.ManyToManyField(related_name='following', through='fedireads.UserRelationship', to=settings.AUTH_USER_MODEL),
17+
field=models.ManyToManyField(related_name='following', through='bookwyrm.UserRelationship', to=settings.AUTH_USER_MODEL),
1818
),
1919
]

bookwyrm/migrations/0009_status_published_date.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
class Migration(migrations.Migration):
88

99
dependencies = [
10-
('fedireads', '0008_auto_20200224_1504'),
10+
('bookwyrm', '0008_auto_20200224_1504'),
1111
]
1212

1313
operations = [

0 commit comments

Comments
 (0)