Canvas: SQLSTATE[23000]: Integrity constraint violation

Created on 30 Dec 2016  路  16Comments  路  Source: austintoddj/canvas

Hello,

I installed Canvas and I can access to the admin management.
But when I want to publish my first blog post "Hello World", I have this error message :

SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'hello-world-2' for key 'posts_slug_unique' (SQL: insert intoposts(user_id,title,slug,subtitle,page_image,content_raw,content_html,meta_description,is_draft,published_at,layout,updated_at,created_at) values (2, Hello World 2, hello-world-2, Y'en a pas, , aaaaa, <p>aaaaa</p>, , 0, 2016-12-30 16:34:56, canvas::frontend.blog.post, 2016-12-30 16:35:10, 2016-12-30 16:35:10))

Could you tell me what's the issue ?
I tried to create another blog with another name in case of but the result is the same.
I did nothing manually regarding the database, simply installed Canvas.
Thanks!

Environnement :
Digital Ocean server through Cloudways
PHP 5.6
MySQL 5.5

All 16 comments

@PastaGringo Right now, Canvas is in the process of transforming into 2 separate repositories, so an issue like this falls under what is to be expected during this process. Apologies for the issue, but it will be resolved in the next available release.

All right, wait and see ;)
Hope to use Cancas!
Thanks

Good to hear! Yes, the next release is a major upgrade. So if you can hold out just a short while, it'll be worth it!

Ok @PastaGringo, the latest release is out and should solve this issue. Feel free to close it out when you see it work! 馃憤

Good news !

I reinstalled the v3 but now I have :

PDOException in TNTIndexer.php line 539:
SQLSTATE[HY000]: General error: 8 attempt to write a readonly database

Does the installation process has been modified?
Thanks

@PastaGringo What are the permissions on your storage directory?

This issue has some more history located at issue #192

The storage directory has this permission :
drwxrwxrwx 5 www-data www-data 4096 Jan 5 17:10 storage

The blog is up, I can access to the admin panel with credentials typed during the Canvas wizard.
But when I create a new blog article, I got the same message again with the URL http://hostip/admin/post

If I refresh the webpage, the article is created but it does not appear on the Canvas homepage.
I use this script to install Canvas if you want to check if I did something wrong : https://github.com/PastaGringo/scripts/blob/master/install_canvas

Thanks !

@PastaGringo Could you give the Official installation instructions a try and see if you see any different results?

I made this script, it simply install dependencies needed by Canvas before installing it.
The only instructions we have on the Official installation instructions are :
composer create-project --prefer-dist cnvs/canvas blog and to modify the .envfile.

I think it could be more useful to add this command to the instructions : php artisan canvas:install
and if it's possible at least some basics command to install a sample PHP environnement.

I'm currently creating this script to permit to start a Canvas demo within few minutes.
I continue to search where is the problem with my Canvas set up.

@PastaGringo I'd love to see what you come up with as far as a script that could get everything set up and running for a complete novice. That could be very useful.. Let me know if I can do anything to help you.

It's ok! I found the issue 馃憤
It was related to SQLite .index files which was owned by root account.
Now I set www-data owner to *.index files in storage directory right after the php artisan canvas:install command.

But I have still a weird issue, when I create a new post (with no error) the post is not displayed from the Canvas home page. There is any time to wait before seeing the post ?

And to finish, there is anyway to automate the info typed and needed in the Canvas wizard ?

It's actually intentional. The idea behind having a Quick Draft form on the homepage was so that you could quickly jot down your thoughts, save it, and then actually come back to edit it later. So if you do it again, save a quick draft, and it'll take you to the editing of that post, and notice how it is marked as a Draft. Draft posts can't be seen from the frontend, they need to be published. Does that make sense?

Yes that make sens and I could use this function because I have many thoughts per day and it's a good way to save them for publish them later. But currently, the post has the "published" status and it's not displayed from the homepage (I can give you credentials, it's a free VPS for 2 hours).

And to finish, there is anyway to automate the info typed and needed in the Canvas wizard ?

Not aware of any automation like that no.

The only thing I can think of now for that post issue might be the layout value that it has in the database. What is that post currently showing?

Hello @austintoddj,

I found the solution, I need to publish the post one day before the "today date" and it appears !

Updated PHP dependencies and storage owner/permissions (www-data & 777)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

austintoddj picture austintoddj  路  10Comments

armancodes picture armancodes  路  7Comments

hoRacy picture hoRacy  路  5Comments

connecteev picture connecteev  路  6Comments

lunadiotic picture lunadiotic  路  7Comments