# Moving to a new server - error with database

**URL:** https://meta.discourse.org/t/moving-to-a-new-server-error-with-database/149027
**Category:** Self-hosting
**Created:** [April 23, 2020, 5:01pm UTC](https://meta.discourse.org/t/moving-to-a-new-server-error-with-database/149027 "2020-04-23T17:01:52Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![nevscope](https://avatars.discourse-cdn.com/v4/letter/n/2bfe46/32.png) [@nevscope](https://meta.discourse.org/u/nevscope)
#### Post date: [April 23, 2020, 5:01pm UTC](https://meta.discourse.org/t/moving-to-a-new-server-error-with-database/149027/1 "2020-04-23T17:01:52Z")

</div>

We are trying to move everything to a new server, after the migration we get this message on top:

 ![image](https://global.discourse-cdn.com/meta/original/3X/f/5/f52093bbc2a32b75469c4ac7bb93bd0376fa133c.png)

when I try to run the following inside the app:

```
  # sudo ./launcher enter app
  # rails c
  > user = User.find_by_email("<admin_email>")
  > user.admin = true
  > user.save`

```

I get the following error:

> ActiveModel::MissingAttributeError: can’t write unknown attribute ``  
> from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activemodel-6.0.2.2/lib/active\_model/attribute.rb:206:in `with_value_from_database' Caused by ActiveRecord::StatementInvalid: PG::SyntaxError: ERROR: zero-length delimited identifier at or near """" LINE 1: ... = '2020-04-23 16:30:36.173916' WHERE "site_settings"."" = 3 ^ from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/rack-mini-profiler-2.0.1/lib/patches/db/pg.rb:69:in `exec\_params’  
> Caused by PG::SyntaxError: ERROR: zero-length delimited identifier at or near “”“”  
> LINE 1: … = ‘2020-04-23 16:30:36.173916’ WHERE “site\_settings”.“” = 3  
> ^  
> from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/rack-mini-profiler-2.0.1/lib/patches/db/pg.rb:69:in `exec\_params’

Any ideas on how to finalise installation? It may look like a table is corrupted.

---

<div class="post-metadata">

### Author: ![justin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/justin/32/157614_2.png) [@justin](https://meta.discourse.org/u/justin)
#### Post date: [April 23, 2020, 5:05pm UTC](https://meta.discourse.org/t/moving-to-a-new-server-error-with-database/149027/2 "2020-04-23T17:05:21Z")

</div>

Can you back up and tell us more exactly of what you’re trying to do? Is this prior to restoring a backup or after? Or is this a new install?

---

<div class="post-metadata">

### Author: ![nevscope](https://avatars.discourse-cdn.com/v4/letter/n/2bfe46/32.png) [@nevscope](https://meta.discourse.org/u/nevscope)
#### Post date: [April 23, 2020, 5:06pm UTC](https://meta.discourse.org/t/moving-to-a-new-server-error-with-database/149027/3 "2020-04-23T17:06:50Z")

</div>

Steps we did:

1. Install latest version on new server
2. Switched old server to read only, took backup
3. Restored backup on new server

Error is happening after number 3 and we repeated process twice.

---

<div class="post-metadata">

### Author: ![justin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/justin/32/157614_2.png) [@justin](https://meta.discourse.org/u/justin)
#### Post date: [April 23, 2020, 5:07pm UTC](https://meta.discourse.org/t/moving-to-a-new-server-error-with-database/149027/4 "2020-04-23T17:07:39Z")

</div>

Do you have a developer email defined in `app.yml`? Have you tried rebuilding the container yet?

---

<div class="post-metadata">

### Author: ![nevscope](https://avatars.discourse-cdn.com/v4/letter/n/2bfe46/32.png) [@nevscope](https://meta.discourse.org/u/nevscope)
#### Post date: [April 23, 2020, 5:10pm UTC](https://meta.discourse.org/t/moving-to-a-new-server-error-with-database/149027/5 "2020-04-23T17:10:05Z")

</div>

> [@justin](#):
>
> Do you have a developer email defined in `app.yml` ? Have you tried rebuilding the container yet?

yes. Discourse without importing migration works correctly. No errors. After the backup database is restored settings cannot be modified because we get an error and trying to activate the devs email doesn’t send an email. thats why I was trying to activate the account manually, but then I encountered that error

---

<div class="post-metadata">

### Author: ![justin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/justin/32/157614_2.png) [@justin](https://meta.discourse.org/u/justin)
#### Post date: [April 23, 2020, 5:11pm UTC](https://meta.discourse.org/t/moving-to-a-new-server-error-with-database/149027/6 "2020-04-23T17:11:25Z")

</div>

Have you done a `./launcher rebuild app` after the backup restore? Or entered the container and run `rake db:migrate`? That may help, but can’t say for sure until we try 😃

---

<div class="post-metadata">

### Author: ![nevscope](https://avatars.discourse-cdn.com/v4/letter/n/2bfe46/32.png) [@nevscope](https://meta.discourse.org/u/nevscope)
#### Post date: [April 23, 2020, 5:14pm UTC](https://meta.discourse.org/t/moving-to-a-new-server-error-with-database/149027/7 "2020-04-23T17:14:45Z")

</div>

I already run launcher rebuild app but the problem is still there. Do I run the rake from the server or from inside the app (launcher enter app)?

---

<div class="post-metadata">

### Author: ![justin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/justin/32/157614_2.png) [@justin](https://meta.discourse.org/u/justin)
#### Post date: [April 23, 2020, 5:15pm UTC](https://meta.discourse.org/t/moving-to-a-new-server-error-with-database/149027/8 "2020-04-23T17:15:41Z")

</div>

`./launcher rebuild app` will do the same thing.

Do you still have the previous instance running? If so, your best bet going forward is to destroy the new one and rebuild it with a fresh backup from the old instance.

---

<div class="post-metadata">

### Author: ![nevscope](https://avatars.discourse-cdn.com/v4/letter/n/2bfe46/32.png) [@nevscope](https://meta.discourse.org/u/nevscope)
#### Post date: [April 23, 2020, 5:17pm UTC](https://meta.discourse.org/t/moving-to-a-new-server-error-with-database/149027/9 "2020-04-23T17:17:38Z")

</div>

Yes, the previous server is still running. Having investigated the problem more deeply, this happens even in the old server. Same error pops up. 🤨

---

<div class="post-metadata">

### Author: ![nevscope](https://avatars.discourse-cdn.com/v4/letter/n/2bfe46/32.png) [@nevscope](https://meta.discourse.org/u/nevscope)
#### Post date: [April 23, 2020, 5:18pm UTC](https://meta.discourse.org/t/moving-to-a-new-server-error-with-database/149027/10 "2020-04-23T17:18:38Z")

</div>

Shall I try to clear the site\_settings table and re-set them manually? Will Discourse work after I delete all records from this table manually from postgresql?

---

<div class="post-metadata">

### Author: ![justin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/justin/32/157614_2.png) [@justin](https://meta.discourse.org/u/justin)
#### Post date: [April 23, 2020, 5:21pm UTC](https://meta.discourse.org/t/moving-to-a-new-server-error-with-database/149027/11 "2020-04-23T17:21:04Z")

</div>

I would avoid doing that unless you know what you’re doing.

You may want to post in #Marketplace for more advanced help. Sounds like you might have a broken install unfortunately.
