Комментарии:
if anyone has problems running the migration again when "php migrations.php" is ran so you can add "m0002_add_password_column" modify the "$SQL" variable your "m0001_initial" to look like the following:
ORIGINAL/VIDEO
$SQL = "CREATE TABLE users (
id INT AUTO_INCREMENT PRIMARY KEY,
email VARCHAR(255) NOT NULL,
firstname VARCHAR(255) NOT NULL,
lastname VARCHAR(255) NOT NULL,
status TINYINT DEFAULT 0,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
) ENGINE=INNODB;";
ALTERED/ FIXED
$SQL = "CREATE TABLE IF NOT EXISTS users (
id INT AUTO_INCREMENT PRIMARY KEY,
email VARCHAR(255) NOT NULL,
firstname VARCHAR(255) NOT NULL,
lastname VARCHAR(255) NOT NULL,
status TINYINT DEFAULT 0,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
) ENGINE=INNODB;";
Zura, If you have already run the php migrations.php command and it successfully applied the initial migration (m0001_initial.php), it should have recorded this migration in your migrations table. If you add a new migration file (e.g., m0002_add_password_column.php) and run the php migrations.php command again, your migration system should check the migrations table, see that m0001_initial.php has already been applied, and proceed to apply any subsequent migrations (in this case, m0002_add_password_column.php).? would that be correct? it looks like it worked for you but In my case i had to alter the SQL statement?
How is the down() method triggered?
ОтветитьAny advice for help with the migrations? I saw this comment on free code camp since it wasn't working the original code:
className = pathinfo($migration, PATHINFO_FILENAME);
$class = "app\migrations\\" . $className;
$instance = new $class;
echo "Applying migration $migration ..." . PHP_EOL;
$instance->up();
echo "Applied migration $migration" . PHP_EOL;
When I try to substantiate an instance with new $class, I get the following error: Cannot declare class m0001_initial, because the name is already in use. No namespace on a m000 files. Thanks!
Thanks a lot 💚
Ответитьfascinating stuff. I did have to resolve a bug on line 35 of Database.php. I had to instantiate the migration classes prefixed with the namespace:
$className = 'app\migrations\\' . pathinfo($migration, PATHINFO_FILENAME);
$instance = new $className();
I'm not sure why I needed this on my environment. Maybe my autoload isn't set up right. After I added the namespace, the migrations did run correctly.
what is the name of the theme u r using
ОтветитьThanks to the best PHP teacher <3
ОтветитьSimply awesome how you demystify the features that laravel, symfony, etc have!
Thx a lot for this great tutorial! Learnt a lot!
<3
ОтветитьThank you Zura . Never stop teaching us 🙂🙂🙂🙂
Ответить💫
ОтветитьHey, man. Can you please make a video about ORM and DBAL?
Ответитьhame to bootcamp parashon rikhte
Ответитьsoltani dadash
Ответитьdamet garm
Ответитьhello , its okey if i used mysqli instead of pdo ?
ОтветитьGood Job, Please keep making such good content on php
ОтветитьI was quite mesmerized. I can swear it's the best tutorial series I've ever seen in my life. Your content is very high quality. Thanks to you, I learned very well how Laravel and similar frameworks are developed. When I'm bored, I watch the video series. I will code soon. Gold content. thank you so much
Ответитьhow we can execute the down method from terminal ?
ОтветитьThis series is excellent. Great job.
ОтветитьGreat ways todo alot of the items, but i suggest to change the following:
change in .env file to be DB_DSN = "..." or do one parameter for each and create your own DSN string
which makes you able to do
$env = parse_ini_file(dirname(__DIR__).'\.env');
and no need for depending on vlucas/phpdotenv
For anyone having issues with Uncaught PDOException: SQLSTATE[3D000]:
for some reason putting the port last worked for me.
mysql:host=localhost;dbname=dbname;port=3306
Thank you so much!
ОтветитьAwesome tutorial
ОтветитьHello!! So cool! Am a new lunix mint user. Been trying to run migrations with no success. Please help😊. Watched tones and tones of videos but it's not working😫. Wanna be able to follow the creation of the framework alongside.
ОтветитьInteresting video but I dont like the idea of using php in a view file, or generate dynamic html in a php file
ОтветитьHi, Thanks for your video and i have a problem on migration idont know how to handle this the problem is "Fatal error: Uncaught PDOException: SQLSTATE[3D000]: Invalid catalog name: 1046 No database selected in C:\xampp\htdocs\myFrameWork\core\Database.php". can you please tell me what wrong with it? Thanks!
ОтветитьHi!
I really like your video. Until this part, everything went well and everything was okay, but now I got this error message:
Fatal error: Uncaught PDOException: SQLSTATE[HY000] [2002] No such file or directory.
I'm using XAMP on macOS Catalina 10.15.7.
Again great tutorial. Got migration class not found in core folder error when run migration. I know it should search migrations folder rather than core folder. I follow exact every steps including add require_once in the applyMigrations function. Any body can help? thanks
Ответитьhi, i have a problem with connecting to database. i'm using lampp for mysql and for my other projects work just fine. but in this project i face this error: Uncaught PDOException: SQLSTATE[HY000] [2002] No such file or directory . i run this project with php -S and without database connection work perfectly. can you help me with this? i setup virtual host for this project but also not working. i also install mysql-server with terminal but no diffrence. running ubuntu 20.04 .
ОтветитьCreate a tutorial using AJAX sir, I`m quite curious on how you do it
ОтветитьIs this how also in Frameworks like Laravel/CodeIgniter is done, because once I was able to grasp your lessons, I want to jump in to Laravel, so what I mean is I want to use your Lesson as a key in order for me to start learning Larave
Ответитьvery good information tq for provoding great lectures. keep move on always providing good content.
ОтветитьThanks for video !! I'm feeling so profissional with your tutorials 😁😁😁!!
.
Thank you again for very informative tutorial 🥇🥇🥇
ОтветитьGreat lesson! Didn’t know this trick with converting array to string so PDO can eat an array like that :) php isn’t trendy but is still awesome tool
ОтветитьDo you will implement a DI container for this project?
Ответитьat last. Maybe you will open the videos every day insted of one video in two days?
Ответитьvery informative)
ОтветитьThanx
ОтветитьThank you so much for this amezing course.god bless you bro
ОтветитьThanks for video 😘
Ответить