質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Heroku

HerokuはHeroku社が開発と運営を行っているPaaSの名称です。RubyやNode.js、Python、そしてJVMベース(Java、Scala、Clojureなど)の複数のプログラミング言語をサポートしている。

MySQL

MySQL(マイエスキューエル)は、TCX DataKonsultAB社などが開発するRDBMS(リレーショナルデータベースの管理システム)です。世界で最も人気の高いシステムで、オープンソースで開発されています。MySQLデータベースサーバは、高速性と信頼性があり、Linux、UNIX、Windowsなどの複数のプラットフォームで動作することができます。

SQLite

SQLiteはリレーショナルデータベース管理システムの1つで、サーバーではなくライブラリとして使用されている。

Laravel

LaravelとはTaylor Otwellによって開発された、オープンソースなPHPフレームワークです。Laravelはシンプルで表現的なシンタックスを持ち合わせており、ウェブアプリケーション開発の手助けをしてくれます。

データベース

データベースとは、データの集合体を指します。また、そのデータの集合体の共用を可能にするシステムの意味を含めます

Q&A

解決済

1回答

1605閲覧

【heroku】git push heroku master時におけるエラーの解消方法について(質問欄に具体的な質問事項を記載致しました)

genshi

総合スコア6

Heroku

HerokuはHeroku社が開発と運営を行っているPaaSの名称です。RubyやNode.js、Python、そしてJVMベース(Java、Scala、Clojureなど)の複数のプログラミング言語をサポートしている。

MySQL

MySQL(マイエスキューエル)は、TCX DataKonsultAB社などが開発するRDBMS(リレーショナルデータベースの管理システム)です。世界で最も人気の高いシステムで、オープンソースで開発されています。MySQLデータベースサーバは、高速性と信頼性があり、Linux、UNIX、Windowsなどの複数のプラットフォームで動作することができます。

SQLite

SQLiteはリレーショナルデータベース管理システムの1つで、サーバーではなくライブラリとして使用されている。

Laravel

LaravelとはTaylor Otwellによって開発された、オープンソースなPHPフレームワークです。Laravelはシンプルで表現的なシンタックスを持ち合わせており、ウェブアプリケーション開発の手助けをしてくれます。

データベース

データベースとは、データの集合体を指します。また、そのデータの集合体の共用を可能にするシステムの意味を含めます

0グッド

0クリップ

投稿2020/07/22 08:08

編集2020/07/22 08:10

###【前提・実現したいこと】
[heroku]PHP(Laravel)でgit push heroku masterした際にエラーが出たため、エラーを解消したい。

###【概要】
PHP(Laravel)で作成したToDoアプリをgit push heroku masterした際に
以下のエラーメッセージが発生しました。

###【エラーメッセージについて】

XXnoMacBook-Pro:todo XX$ git push heroku master Enumerating objects: 206, done. Counting objects: 100% (206/206), done. Delta compression using up to 16 threads Compressing objects: 100% (183/183), done. Writing objects: 100% (206/206), 541.04 KiB | 5.10 MiB/s, done. Total 206 (delta 32), reused 0 (delta 0) remote: Compressing source files... done. remote: Building source: remote: remote: -----> PHP app detected remote: -----> Bootstrapping... remote: -----> Installing platform packages... remote: - php (7.4.8) remote: - ext-mbstring (bundled with php) remote: - apache (2.4.43) remote: - nginx (1.18.0) remote: -----> Installing dependencies... remote: Composer version 1.10.7 2020-06-03 10:03:56 remote: Loading composer repositories with package information remote: Installing dependencies from lock file remote: Package operations: 59 installs, 0 updates, 0 removals remote: - Installing doctrine/inflector (1.3.1): Downloading (100%) remote: - Installing doctrine/lexer (1.2.0): Downloading (100%) remote: - Installing dragonmantank/cron-expression (v2.3.0): Downloading (100%) remote: - Installing voku/portable-ascii (1.4.10): Downloading (100%) remote: - Installing symfony/polyfill-ctype (v1.15.0): Downloading (100%) remote: - Installing phpoption/phpoption (1.7.3): Downloading (100%) remote: - Installing vlucas/phpdotenv (v4.1.3): Downloading (100%) remote: - Installing symfony/css-selector (v5.0.7): Downloading (100%) remote: - Installing tijsverkoyen/css-to-inline-styles (2.2.2): Downloading (100%) remote: - Installing symfony/polyfill-mbstring (v1.15.0): Downloading (100%) remote: - Installing symfony/var-dumper (v5.0.7): Downloading (100%) remote: - Installing symfony/routing (v5.0.7): Downloading (100%) remote: - Installing symfony/process (v5.0.7): Downloading (100%) remote: - Installing symfony/polyfill-php72 (v1.15.0): Downloading (100%) remote: - Installing symfony/polyfill-intl-idn (v1.15.0): Downloading (100%) remote: - Installing symfony/mime (v5.0.7): Downloading (100%) remote: - Installing symfony/polyfill-php73 (v1.15.0): Downloading (100%) remote: - Installing symfony/http-foundation (v5.0.7): Downloading (100%) remote: - Installing psr/event-dispatcher (1.0.0): Downloading (100%) remote: - Installing symfony/event-dispatcher-contracts (v2.0.1): Downloading (100%) remote: - Installing symfony/event-dispatcher (v5.0.7): Downloading (100%) remote: - Installing psr/log (1.1.3): Downloading (100%) remote: - Installing symfony/error-handler (v5.0.7): Downloading (100%) remote: - Installing symfony/http-kernel (v5.0.7): Downloading (100%) remote: - Installing symfony/finder (v5.0.7): Downloading (100%) remote: - Installing psr/container (1.0.0): Downloading (100%) remote: - Installing symfony/service-contracts (v2.0.1): Downloading (100%) remote: - Installing symfony/console (v5.0.7): Downloading (100%) remote: - Installing symfony/polyfill-iconv (v1.15.0): Downloading (100%) remote: - Installing egulias/email-validator (2.1.17): Downloading (100%) remote: - Installing swiftmailer/swiftmailer (v6.2.3): Downloading (100%) remote: - Installing ramsey/collection (1.0.1): Downloading (100%) remote: - Installing brick/math (0.8.14): Downloading (100%) remote: - Installing ramsey/uuid (4.0.1): Downloading (100%) remote: - Installing psr/simple-cache (1.0.1): Downloading (100%) remote: - Installing opis/closure (3.5.1): Downloading (100%) remote: - Installing symfony/translation-contracts (v2.0.1): Downloading (100%) remote: - Installing symfony/translation (v5.0.7): Downloading (100%) remote: - Installing nesbot/carbon (2.32.2): Downloading (100%) remote: - Installing monolog/monolog (2.0.2): Downloading (100%) remote: - Installing league/flysystem (1.0.66): Downloading (100%) remote: - Installing league/commonmark (1.3.2): Downloading (100%) remote: - Installing laravel/framework (v7.4.0): Downloading (100%) remote: - Installing fideloper/proxy (4.3.0): Downloading (100%) remote: - Installing asm89/stack-cors (1.3.0): Downloading (100%) remote: - Installing fruitcake/laravel-cors (v1.0.5): Downloading (100%) remote: - Installing ralouphie/getallheaders (3.0.3): Downloading (100%) remote: - Installing psr/http-message (1.0.1): Downloading (100%) remote: - Installing guzzlehttp/psr7 (1.6.1): Downloading (100%) remote: - Installing guzzlehttp/promises (v1.3.1): Downloading (100%) remote: - Installing guzzlehttp/guzzle (6.5.2): Downloading (100%) remote: - Installing jakub-onderka/php-console-color (v0.2): Downloading (100%) remote: - Installing nikic/php-parser (v4.3.0): Downloading (100%) remote: - Installing jakub-onderka/php-console-highlighter (v0.4): Downloading (100%) remote: - Installing dnoegel/php-xdg-base-dir (v0.1.1): Downloading (100%) remote: - Installing psy/psysh (v0.10.2): Downloading (100%) remote: - Installing laravel/tinker (v2.3.0): Downloading (100%) remote: - Installing laravel/ui (v2.0.3): Downloading (100%) remote: - Installing predis/predis (v1.1.1): Downloading (100%) remote: Package jakub-onderka/php-console-color is abandoned, you should avoid using it. Use php-parallel-lint/php-console-color instead. remote: Package jakub-onderka/php-console-highlighter is abandoned, you should avoid using it. Use php-parallel-lint/php-console-highlighter instead. remote: Generating optimized autoload files remote: > Illuminate\Foundation\ComposerScripts::postAutoloadDump remote: > @php artisan package:discover --ansi remote: remote: In Connection.php line 670: remote: remote: Database (/tmp/build_edc01494/database/database.sqlite) does not exist. (SQ remote: L: PRAGMA foreign_keys = ON;) remote: remote: remote: In SQLiteConnector.php line 34: remote: remote: Database (/tmp/build_edc01494/database/database.sqlite) does not exist. remote: remote: remote: Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1 remote: ! WARNING: A post-autoload-dump script terminated with an error remote: remote: ! ERROR: Dependency installation failed! remote: ! remote: ! The 'composer install' process failed with an error. The cause remote: ! may be the download or installation of packages, or a pre- or remote: ! post-install hook (e.g. a 'post-install-cmd' item in 'scripts') remote: ! in your 'composer.json'. remote: ! remote: ! Typical error cases are out-of-date or missing parts of code, remote: ! timeouts when making external connections, or memory limits. remote: ! remote: ! Check the above error output closely to determine the cause of remote: ! the problem, ensure the code you're pushing is functioning remote: ! properly, and that all local changes are committed correctly. remote: ! remote: ! For more information on builds for PHP on Heroku, refer to remote: ! https://devcenter.heroku.com/articles/php-support remote: ! remote: ! REMINDER: the following warnings were emitted during the build; remote: ! check the details above, as they may be related to this error: remote: ! - A post-autoload-dump script terminated with an error remote: remote: ! Push rejected, failed to compile PHP app. remote: remote: ! Push failed remote: Verifying deploy... remote: remote: ! Push rejected to tskmgmt-tool. remote: To https://git.heroku.com/tskmgmt-tool.git ! [remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs to 'https://git.heroku.com/tskmgmt-tool.git'

【確認したこと】

In Connection.php line 670: Database (/tmp/build_edc01494/database/database.sqlite) does not exist. (SQL: PRAGMA foreign_keys = ON;) In SQLiteConnector.php line 34: Database (/tmp/build_edc01494/database/database.sqlite) does not exist.

上記に関してエラーが出ているのですが、ToDoアプリ開発に際してはMySQLを使用しています。

※ただ、当アプリを開発する初期に、sqliteを使用するつもりでdatabase配下にdatabase.sqlite及びdummy_database.sqlite(誤作成と思われる)というファイルを作成しており、そのDBファイルが未だ存在している事がエラーの原因なのかと推測しております。

###【質問】
①database.sqlite及びdummy_database.sqliteの2ファイルは削除することでエラーが解決するかどうか
②それともそれ以外に問題点があるのか

尚、Connection.php line 670及びSQLiteConnector.php line 34に関しては、ファイルを見つける事ができなかった為、自身のファイル構造に対する知識理解が足りていない状況です。

知識が欠落している中での質問となってしまい、大変恐縮ですが、自作アプリの公開というビッグイベントを無事遂行すべく、お力添えいただけますと幸いです。
よろしくお願い致します。

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

ベストアンサー

①database.sqlite及びdummy_database.sqliteの2ファイルは削除することでエラーが解決するかどうか

おそらく、それでは解決しません

②それともそれ以外に問題点があるのか

Heroku ではデータベースをどのように準備するつもりでいますか?

Heroku の標準では PostgreSQL を使うことになります
Heroku Postgres | Heroku Dev Center

Add on の形になりますが、無料で MySQL のデータベースを使うこともできます
(ただし、確かクレジット登録が必要でした)
ClearDB MySQL | Heroku Dev Center

データベースを用意したら、

データベースに接続するための URL が得られます

Database: Getting Started - Laravel - The PHP Framework For Web Artisans

Typically, database connections are configured using multiple configuration values
such as host, database, username, password, etc.
Each of these configuration values has its own corresponding environment variable.
This means that when configuring your database connection information
on a production server, you need to manage several environment variables.

Some managed database providers such as Heroku provide a single database "URL"
that contains all of the connection information for the database in a single string.
An example database URL may look something like the following:

text

1mysql://root:password@127.0.0.1/forge?charset=UTF-8

These URLs typically follow a standard schema convention:

text

1driver://username:password@host:port/database?options

For convenience,
Laravel supports these URLs as an alternative to configuring your database
with multiple configuration options.
If the url (or corresponding DATABASE_URL environment variable)
configuration option is present,
it will be used to extract the database connection and credential information.

上記 Laravel のドキュメントにあるように、
取得した URL を Heroku CLI か Heroku Dashboard で DATABASE_URL という環境変数に設定します

Configuration and Config Vars | Heroku Dev Center

投稿2020/07/22 11:09

y_shinoda

総合スコア3272

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

genshi

2020/07/23 03:34

y_shinoda様 詳細なコメント有り難うございます。 今回のエラーについて色々と確認してみましたところ、 config > database.phpの 'default' => env('DB_CONNECTION', '○○')の○○がsqliteを指定していたので、mysqlに変更したところエ ラーが解消されました。 大変初歩的な誤りであり恥ずかしい気持ちでたまらないとともに、お時間をいただいてしまい大変申し訳ないところです。 また、大変多くの参考URLをいただきまして、有り難うございます。 ClearDBmysqlについての記述等、参考にさせていただき、無事アプリの公開を行う事ができました。 それ以外のものに関しましても、自己の技術向上に際して是非参考にさせていただきたい所存でございます。 どうも有り難う御座いました。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問